A network can use more than one routing protocol, and routers on the network can learn about a route from multiple sources. Routers need to find a way to select a better path when there are multiple paths available. Administrative distance number is used by routers to find out which route is better (lower number is better). For example, if the same route is learned from RIP and EIGRP, a Cisco router will choose the EIGRP route and stores it in the routing table. This is because EIGRP routes have (by default) the administrative distance of 90, while RIP route have a higher administrative distance of 120.
You can display the administrative distance of all routes on your router by typing the show ip route command:
In the case above, the router has only a single route in its routing table learned from a dynamic routing protocols – the EIGRP route.
The following table lists the administrative distance default values:
If a router learns two different paths for the same network from the same routing protocol, it has to decide which route is better and will be placed in the routing table. Metric is the measure used to decide which route is better (lower number is better). Each routing protocol uses its own metric. For example, RIP uses hop counts as a metric, while OSPF uses cost.
The following example explains the way RIP calculates its metric and why it chooses one path over another.
RIP has been configured on all routers. Router 1 has two paths to reach the subnet 10.0.0.0/24. One path is goes through Router 2, while the other path goes through Router 3 and then Router 4. Because RIP uses the hop count as its metric, the path through Router 2 will be used to reach the 10.0.0.0/24 subnet. This is because that subnet is only one router away on the path. The other path will have a higher metric of 2, because the subnet is two routers away.
The example above can be used to illustrate a disadvantage of using RIP as a routing protocol. Imagine if the first path through R2 was the 56k modem link, while the other path (R3-R4) is a high speed WAN link. Router R1 would still chose the path through R2 as the best route, because RIP uses only the hop count as its metric.
The following table lists the parameters that various routing protocols use to calculate the metric: