Network Design and Operations
A router's routing table holds three routes: a static route 10.0.0.0/8 (next hop router A, administrative distance 1), 10.1.0.0/16 learned by OSPF (router B, 110) and 10.1.1.0/24 learned by RIP (router C, 120). To which router is a packet for 10.1.1.5 sent?
- ARouter A (the static route)
- BRouter B (the OSPF route)
- CRouter C (the RIP route)
Show answer and explanation
Answer: C. Router C (the RIP route)
The three routes have different prefix lengths, so each is installed in the routing table as a separate route. When forwarding a packet, the router chooses the matching route with the longest prefix and does not compare administrative distances. 10.1.1.5 matches all three, but the longest, the /24 RIP route, is chosen and the packet goes to router C. Administrative distance is used only to decide which of several routes to the same destination with the same prefix length goes into the routing table.
- A. The static route has the highest preference, but the /8 is the shortest match, so it is not chosen.
- B. The /16 also matches, but the longer /24 matches too, so it is not chosen.
- C. Correct. The /24 route, the longest match, is chosen.