Routing metric explained
If a routers learns about multiple different paths to the same network from the same routing protocol, a measure called metric is used to decide which route will be placed in the routing table. Just like with the administrative distance, the lower number represents the better route.
Each routing protocol has its own way to calculate the metric; Routing Information Protocol (RIP) uses hop counts, OSPF uses a parameter called cost, EIGRP uses bandwidth and the delay to compute the metrics, etc. Note that metrics of different routing protocols can not be directly compared – an EIGRP route might have a metric of 4.042.334, while a RIP route can have a metric of 3.
To understand the importance of routing metrics, consider the following example:
Let’s say that all routers are running RIP. R1 receives two possible routes to the 10.0.0.0/24 network; one going through R2, and one going through R3 and R4. Both routes are RIP routes and have the same administrative distance, so the metric is used to determine the best route. The RIP metric is hop count, which is simply a number of routers between the source and destination. In this case, the route going through R2 will have a metric of one, because only one router is in the path to the 10.0.0.0/24 network. The route going through R3 and R4 will have a metric of two. The first route will be placed in the routing table and used for packets sent to the 10.0.0.0/24 subnet.