Exploring the Functions of Routing
Routing is the process that forwards data packets between networks or subnetworks using a Layer 3 device: a router or gateway. The routing process uses network routing tables, protocols, and algorithms to determine the most efficient path for forwarding the IP packet. Routers greatly expand the scalability of networks by terminating Layer 2 collisions and broadcast domains. Understanding how routers function will help you understand the broader topic of how networks are connected and how data is transmitted over networks.
The following sections describe the operation of routers.
A router or gateway is a network device that determines the optimal path for transmitting data from one network to another. A router is a specialized computing device running programs and algorithms that aid in the optimal delivery of network traffic. Certain characteristics are common to all routers. Figure 4-1 shows a picture of various Cisco 2800 series routers.
Figure 4-1 Cisco 28000 Series Routers
Routers are essential components of large networks that use TCP/IP, because routers provide the ability to accommodate growth across wide geographical areas. The following
characteristics are common to all routers:
- Routers have these components, which are also found in computers and switches:
Exploring the Functions of Routing 239
- Routers have network adapters to which IP addresses are assigned.
- Routers can have these types of ports:
- Console port: The router uses a console port for the attachment of a
terminal used for management, configuration, and control. A console port might not be found on all routers.
- Network port: The router has a number of network ports, including different LAN or WAN media ports.
Routers have the following two key functions:
- Path determination: Routers must maintain their routing tables and ensure that other routers know about changes in the network. Routers do this by using a routing protocol to communicate the network information to other routers from a routing table on the router. It is possible to statically populate the routing tables, but statically populating does not scale and leads to problems when the network topology changes, either by design or as a result of outages.
- Console port: The router uses a console port for the attachment of a
- Packet forwarding: Routers use the routing table to determine where to forward packets. Routers forward packets through a network interface toward the destination network identified by the destination IP address in the packet.
During the path determination part of transmitting data over a network, routers evaluate the available paths to remote destinations. This section describes how routers determine the most efficient path for forwarding packets.
There can be many paths to get from one network to another. These paths, also known as routes, can have many different characteristics, such as speed, latency, and media type. The purpose of a router is to communicate with other routers to learn and select the best path, as shown in Figure 4-2
Figure 4-2 Routers Perform Path Selection
These routes are held in routing tables within the software of the router and are then used to determine where to send a packet based on the destination addressing. The following three types of entries in routing tables can be used to select the best path to a remote destination:
- Static routing: This type of routing requires that you manually enter route information into a routing table.
- Dynamic routing: This type of routing builds a routing table dynamically, using routing information that is obtained from routing protocols.
- Default routing: This type of routing replaces the need to hold an explicit route to every network.
The default route entry can be either statically configured or learned from a dynamic routing protocol.
The routing table holds only one entry per network. If there is more than one source of information regarding paths to a particular destination network, the routing process needs to be able to select which source of information should be used in the routing table. Multiple sources come from having multiple dynamic routing protocols running, and from static and default information being available. The routing protocols use different metrics to measure the distance and desirability of a path to a destination network. Because it is not possible to directly select from information provided by different routing protocols, the Cisco routing process assigns a weight, known as the administrative distance, to each source of information. The best, most trusted source has the lowest number.
As part of the path determination process, the routing process builds a routing table that identifies known networks and knows how to reach them. Figure 4-3 shows how a routing table maintains network locations.
Figure 4-3 Routing Tables
Routing metrics vary depending on the routing protocol used. Figure 4-3 shows how routers keep a table of information used to decide how to forward packets.
Routing Table Information
The routing table consists of an ordered list of “known” network addresses—that is, those addresses that have been learned dynamically by the routing process or the statically configured, directly connected networks. Routing tables also include information on destinations and next-hop associations. These associations tell a router that a particular destination is either directly connected to the router or that it can be reached through another router, called the next-hop router, on the way to the final destination. When a router receives an incoming packet, it uses the destination address and searches the routing table to find the best path. If no entry can be found, the router will discard the packet after sending an Internet Control Message Protocol (ICMP) message to the source address of the packet. In Figure 4-3, the routing table of the router in the middle shows that when it receives a packet with a destination address on the 10.1.3.0 network, it must forward the packet to R2.
Routing Update Messages
Routers communicate with each other and maintain their routing tables by transmitting routing update messages. Depending on the particular routing protocol, routing update
messages can be sent periodically or only when there is a change in the network topology. The information contained in the routing update messages includes the destination networks that the router can reach and the routing metric to reach each destination. By analyzing routing updates from neighboring routers, a router can build and maintain its routing table.
Static, Dynamic, Directly Connected, and Default Routes
Routers can learn about other networks through static, dynamic, directly connected, and default routes. The routing tables can be populated by the following methods:
- Directly connected networks: This entry comes from having router interfaces directly attached to network segments and is the most certain method of populating a routing table. If the interface fails or is administratively shut down, the entry for that network will be removed from the routing table. The administrative distance is 0 and, therefore, will preempt all other entries for that destination network, because the entry with the lowest administrative distance is the best, most trusted source.
- Static routes: Static routes are manually entered directly into the configuration of a router by a system administrator. The default administrative distance for a static route is 1; therefore, the static routes will be included in the routing table unless there is a direct connection to that network. Static routes can be an effective method for small, simple networks that do not change frequently.
- Dynamic routes: Dynamic routes are learned by the router, and the information is responsive to changes in the network so that it is constantly being updated. There is, however, always a lag between the time that a network changes and when all the routers become aware of the change. The time delay for a router to match a network change is called convergence time. The shorter the convergence time, the better, and different routing protocols perform differently in this regard. Larger networks require the dynamic routing method because there are usually many addresses and constant changes, which, if not acted upon immediately, would result in loss of connectivity.
- Default route: A default route is used when no explicit path to a destination is found in the routing table. The default route can be manually inserted or populated from a dynamic routing protocol.
Dynamic Routing Protocols
Some routing protocols use their own rules and metrics to build and update routing tables automatically. These protocols are known as dynamic routing protocols because they can adjust dynamically to changes in the network topology.
When a routing protocol updates a routing table, the primary objective of the protocol is to determine the best information to include in the table. The routing algorithm generates a number, called the metric value, for each path through the network. Sophisticated routing protocols can base route selection on multiple metrics, combining them in a single metric. Typically, the smaller the metric number, the better the path. Figure 4-4 shows some network criteria that can be used to establish metrics.
Figure 4-4 Establishing Routing Metrics
Metrics can be based on either a single characteristic or several characteristics of a path.
The metrics that are most commonly used by routing protocols are as follows:
- Bandwidth: The data capacity of a link (the connection between two network devices)
- Delay: The length of time required to move a packet along each link from source to destination—depends on the bandwidth of intermediate links, port queues at each router, network congestion, and physical distance
- Hop count: The number of routers that a packet must travel through before reaching its destination (In Figure 4-4, the hop count from host A to host B would be 1 or 2 depending on the path.)
- Cost: An arbitrary value assigned by a network administrator or operating system, usually based on bandwidth, administrator preference, or other measurement
In addition to the metrics used to select paths, there are also a variety of routing protocol methods. Most routing protocols are designed around one of the following two routing methods: distance vector or link-state.
Distance vector routing: In distance vector routing, a router does not have to know the entire path to every network segment; the router only has to know the direction, or vector, in which to send the packet. The distance vector routing approach determines the direction (vector) and distance (hop count) to any network in the internetwork. Distance vector algorithms periodically (such as every 30 seconds by default for Routing Information Protocol [RIP]) send all or portions of their routing table to their adjacent neighbors.
Routers running a distance vector routing protocol will send periodic updates, even if there are no changes in the network. By receiving the routing table of a neighbor, a router can verify all the known routes and make changes to its local routing table based on updated information received from the neighboring router. This process is also known as “routing by rumor,” because the understanding that a router has of the network topology is based on the perspective of the routing table of a neighbor router. Figure 4-5 shows how distance vector protocols determine routes.
Figure 4-5 Distance Vector Protocols
An example of a distance vector protocol is RIP, which is a commonly used routing protocol that uses hop count as its routing metric. Link-state routing: In link-state routing, each router tries to build its own internal map of the network topology. Each router sends messages into the network when it first becomes active, listing the routers to which it is directly connected and providing information about whether the link to each router is active. The other routers use this information to build a map of the network topology and then use the map to choose the best destination. Link-state routing protocols respond quickly to network changes, sending triggered updates when a network change has occurred and sending periodic updates (link-state refreshes) at long time intervals, such as every 30 minutes.
When a link changes state, the device that detected the change creates an update message regarding that link (route), and that update message is propagated to all routers (running the same routing protocol). Each router takes a copy of the update message, updates its routing tables, and forwards the update message to all neighboring routers. This flooding of the update message is required to ensure that all routers update their databases before creating an updated routing table that reflects the new topology. Figure 4-6 shows how link-state protocols determine routes.
Figure 4-6 Link-State Protocols
Examples of link-state routing protocols are Open Shortest Path First (OSPF) and Intermediate System–to–Intermediate System (IS-IS).
NOTE Cisco developed the Enhanced Interior Gateway Routing Protocol (EIGRP), which combines the best features of distance vector and link-state routing protocols.