Tuesday, September 14, 2010

Route Preference

Suppose a router receives a packet destined for the IP address The router has in its routing table the following three routes:
ProtocolADMetricPrefixNext Hop
To which next hop address will the packet be routed?
If you picked, 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.)