Multiple routing protocols can be utilized by a network, and routers inside the network have the ability to acquire information about a route from a variety of sources. When there are several paths available, routers need to discover a means to select the best path for the connectivity they provide. In order to determine which route is superior, routers make use of the administrative distance. A lower value indicates that the route is superior. In the event that a Cisco router is able to learn the same route from both RIP and EIGRP, for instance, it will select the EIGRP route and save it in the routing table. RIP routes have a higher administrative distance of 120, but EIGRP routes have a default administrative distance of 90. This is the reason why this is the case.
You may display the administrative distance of all routes on your router by typing the show ip route command, which provides the following information:
Router_A#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
D 10.0.0.0 [90/30720] via 192.168.20.2, 00:00:09, FastEthernet0/0
C 192.168.20.0/24 is directly connected, FastEthernet0/0
The router in the above case only has one route in its routing table, which it learned from a dynamic routing protocol. This route is the EIGRP route.
The administrative distance default numbers are shown in the table below:
Routing Protocol |
Administrative Distance |
Directly connected |
0 |
Static route |
1 |
Internal EIGRP |
90 |
OSPF |
110 |
RIP |
120 |
External EIGRP |
170 |
Unknown |
255 |
Metric
In the event when a router employs the same routing protocol to learn two distinct routes for the same network, it is required to determine which of the two routes is superior and consequently will be included in the routing table. The metric is the measure that is used to determine whether path is superior (because a lower number indicates superiority). An individual metric is utilized by every routing protocol. RIP, for instance, use hop counts as a metric, whereas OSPF makes use of cost as metric.
The example that follows demonstrates how RIP determines its measure and the reasoning behind why it selects one option over another alternative.
All routers have RIP setup. The network 10.0.0.0/24 can be accessed by Router 1 in two ways. There are two possible routes; one uses Router 2, and the other uses Router 3 and Router 4. Router 2 will be utilized to access the 10.0.0.0/24 subnet because the hop count is the metric for RIP. Reason being, that subnet is literally just a single router down the road. Since through the other path the subnet is located two routers distant, the alternative link will have a higher metric of 2.