Sep 14, 2010

Route Preference


Suppose a router receives a packet destined for the IP address 192.0.2.73. The router has in its routing table the following three routes:
ProtocolADMetricPrefixNext Hop
OSPF110240192.0.2.0/25172.16.1.1
EIGRP9033789192.0.2.0/24172.16.2.1
RIP1206192.0.2.64/26172.16.3.1
To which next hop address will the packet be routed?
If you picked 172.16.3.1, you're correct. Why? A router evaluates routes in the following order.
  1. Prefix Length - The longest-matching route is preferred first. Prefix length trumps all other route attributes.
  2. Administrative Distance - In the event there are multiple routes to a destination with the same prefix length, the route learned by the protocol with the lowest administrative distance is preferred.
  3. Metric - In the event there are multiple routes learned by the same protocol with same prefix length, the route with the lowest metric is preferred. (If two or more of these routes have equal metrics, load balancing across them may occur.)