Metrics are a way to measure or compare. Routing protocols use metrics to determine which route is the best path.
Purpose of a Metric
There are cases when a routing protocol learns of more than one route to the same destination. To select the best path, the routing protocol must be able to evaluate and differentiate among the available paths. For this purpose, a metric is used. A metric is a value used by routing protocols to assign costs to reach remote networks. The metric is used to determine which path is most preferable when there are multiple paths to the same remote network.
Each routing protocol calculates its metric in a different way. For example, RIP uses hop count, EIGRP uses a combination of bandwidth and delay, and the Cisco implementation of OSPF uses bandwidth. Hop count is the easiest metric to imagine. The hop count refers to the number of routers a packet must cross to reach the destination network.
For Router R3 in the diagram above, 172.16.3.0 is two hops, or two routers, away. For Router R2, network 172.16.3.0 is one hop away and for Router R1, it is 0 hops (because the network is directly connected).
Metrics and Routing Protocols
Different routing protocols use different metrics. The metric used by one routing protocol is not comparable to the metric used by another routing protocol.
Two different routing protocols might choose different paths to the same destination because of using different metrics.
The picture above shows how R1 would reach a network connected to R3. RIP would choose the path with the least amount of hops. In this case going directly from R1 to R3, whereas OSPF would choose the path with the highest bandwidth through R2 and then through to R3.
As a result, the link that RIP has chosen would be very slow, whereas the OSPF chosen link would transfer data at a much higher rate, even if it does have to pass through 1 more router.
Metrics used in IP routing protocols include the following:
■ Hop count: A simple metric that counts the number of routers a packet must traverse.
■ Bandwidth: Influences path selection by preferring the path with the highest bandwidth.
■ Load: Considers the traffic utilization of a certain link.
■ Delay: Considers the time a packet takes to traverse a path.
■ Reliability: Assesses the probability of a link failure, calculated from the interface error count or previous link failures.
■ Cost: A value determined either by the IOS or by the network administrator to indicate preference for a route. Cost can represent a metric, a combination of metrics, or a policy.