The primary function of a router is to send a packet to its destination network, which is the destination IP address of the packet. The router looks up information within its routing table to perform this action.
A routing table is a data file in RAM that is used to store routing information for remote networks and directly connected networks. The routing table contains associations between the network and the next hop. These associations tell the router that a specific destination can best be reached by sending the packet to a particular router, representing the next hop to its final destination. The next-hop association can also be the outgoing interface to the final destination.
A directly connected network is a network that is directly linked to one of the router interfaces. When a router interface is configured with an IP address and subnet mask, the interface becomes a host on that directly attached network. The network address and subnet mask of the interface, along with the interface number and type, are entered into the routing table as a directly connected network. When a router sends a packet to a host, such as a web server, that host is on the same network as the router’s directly connected network.
A remote network is a network that is not directly connected to the router. In other words, a remote network is a network that can only be reached by sending the packet to another router. Remote networks are added to the routing table using a dynamic routing protocol or by configuring static routes. Dynamic routes are routes to remote networks that were automatically learned by the router using a dynamic routing protocol. Static routes are routes to networks manually configured by a network administrator.
The routing table is displayed in privileged EXEC mode with the “show ip route” command; the image shows the above command:
At the top of the routing table (shaded yellow) are the codes with which the networks learned by the router are listed.
For each network listed in the routing table, the following information is included according to the above image:
- R, C : Nomenclature with which the networks learned by the router is identified. In this case, the C means that the route is directly connected to the router, while the R indicates that it has been learned with the dynamic routing protocol RIP.
- 192.168.2.0/24 : Denotes the network address and subnet mask of the remote or directly connected network. In this case, we have several entries of this type.
- [120/1] : These square brackets refer to the Administrative Distance (AD) and Metric concepts we will define later.
- Serial 2/0 : Represents the outgoing interface and/or the IP address of the next-hop router. In this example, Serial 2/0 is the outgoing interface used to reach the 192.168.2.0/24 network.
Metric
Metric is a value used by routing protocols to allocate costs to reach any remote network; each protocol uses its metric. For example, RIP uses hop count, EIGRP which is owned by cisco, uses a combination of bandwidth and delay, and OSPF uses bandwidth. The hop count used by RIP is the simplest metric to understand, i.e., the hop count refers to the number of routers a packet must traverse to reach the destination network.
The metric comes into play when the router learns more than one route to the same destination; for this purpose, the routing protocol must evaluate and differentiate between the available routes and select the way with the lowest metric.
Administrative Distance
The router can learn about a route to the same network through more than one origin (static routing, RIP, EIGRP, OSPF, etc.). The router is the one that must choose which route to install; for a router to establish a route to the same destination with equal cost, both routes must come from the same origin, i.e., both routes must be static, RIP, EIGRP, OSPF, etc.
Although it is not very common, more than one dynamic routing protocol can be implemented in the same network. Because different routing protocols use other metrics, it is impossible to compare the metrics to determine the best route.
Therefore, the administrative distance (AD) defines the preference of a routing origin. Each routing source, including specific routing protocols, static routes, and even directly connected networks, is assigned a preference order from the most preferable to the least preferable using the administrative distance value.
The AD has a value between 0 and 255; the lower the value, the higher the preference of the route’s origin.
The AD value is the first value inside the square brackets for a routing table entry. In the case of the figure above the administrative distance is 120.
The AD value can be verified with the “show ip protocols” command. This command displays all the pertinent information about the routing protocols running on the router.
Table of Default Administrative Distances:
Route Origin |
Administrative Distance |
Directly connected | 0 |
Static | 1 |
EIGRP Summarized Route | 5 |
External BGP | 20 |
Internal EIGRP | 90 |
IGRP | 100 |
OSPF | 110 |
IS-IS | 115 |
RIP | 120 |
External EIGRP | 170 |
Internal BGP | 200 |
Three principles related to routing tables extracted from Alex Zinin’s book, Cisco IP Routing:
- Each router makes its decision independently, based on the information in its routing table.
- The fact that one router has specific information in its routing table does not mean that the other routers have the same information.
-
Routing information about a route from one network to another does not provide routing information about the reverse or return route.