Determining a router's best path involves the evaluation of multiple paths to the same destination network and selecting the optimum or "shortest" path to reach that network. Whenever multiple paths to reach the same network exist, each path uses a different exit interface on the router to reach that network. The best path is selected by a routing protocol based on the value or metric it uses to determine the distance to reach a network. Some routing protocols, such as RIP, use simple hop-count, which the number of routers between a router and the destination network. Other routing protocols, such as OSPF, determine the shortest path by examining the bandwidth of the links, and using the links with the fastest bandwidth from a router to the destination network.

Dynamic routing protocols typically use their own rules and metrics to build and update routing tables. A metric is the quantitative value used to measure the distance to a given route. The best path to a network is the path with the lowest metric. For example, a router will prefer a path that is 5 hops away over a path that is 10 hops away.

The primary objective of the routing protocol is to determine the best paths for each route to include in the routing table. The routing algorithm generates a value, or a metric, for each path through the network. Metrics can be based on either a single characteristic or several characteristics of a path. Some routing protocols can base route selection on multiple metrics, combining them into a single metric. The smaller the value of the metric, the better the path.

Comparing Hop Count and Bandwidth Metrics

Two metrics that are used by some dynamic routing protocols are:Hop count-Hop count is the number of routers that a packet must travel through before reaching its destination. Each router is equal to one hop. A hop count of four indicates that a packet must pass through four routers to reach its destination. If multiple paths are available to a destination, the routing protocol, such as RIP, picks the path with the least number of hops.Bandwidth-Bandwidth is the data capacity of a link, sometimes referred to as the speed of the link. For example, Cisco's implementation of the OSPF routing protocol uses bandwidth as its metric. The best path to a network is determined by the path with an accumulation of links that have the highest bandwidth values, or the fastest links. The use of bandwidth in OSPF will be explained in Chapter 11.

Note: Speed is technically not an accurate description of bandwidth because all bits travel at the same speed over the same physical medium. Bandwidth is more accurately defined as the number of bits that can be transmitted over a link per second.

When hop count is used as the metric, the resulting path may sometimes be suboptimal. For example, consider the network shown in the figure. If RIP is the routing protocol used by the three routers, then R1 will choose the suboptimal route through R3 to reach PC2 because this path has fewer hops. Bandwidth is not considered. However, if OSPF is used as the routing protocol, then R1 will choose the route based on bandwidth. Packets will be able to reach their destination sooner using the two, faster T1 links as compared to the single, slower 56 Kbps link.