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 following table lists the parameters that various routing protocols use to calculate the metric: