Study FAQ
How does a Cisco router choose between overlapping routes?
Also asked as 2
- Which route wins when two prefixes match the same destination?
- How do longest prefix match, administrative distance, and metric affect Cisco route selection?
Answer
A Cisco router forwards an ordinary destination-routed packet using the longest matching prefix already installed for that address. Administrative distance helps choose between eligible routes from different sources for the same prefix. Metrics compare paths within the relevant routing protocol.
For example, suppose the installed table has 10.0.0.0/8, 10.20.0.0/16, and 0.0.0.0/0. A packet for 10.20.5.8 uses the /16 even if the /8 has a lower administrative distance. A packet for 10.99.5.8 uses the /8. The default route is a match of last resort.
On Cisco IOS XE 17.15.x for Catalyst 9300, inspect the exact destination with show ip route 10.20.5.8. Read the selected prefix, route source, and next hop or exit interface. In a typical entry with brackets such as [110/20], the first number is administrative distance and the second is that route's metric. A route lookup identifies the selected path. Confirming that the next hop and return path work requires separate evidence.
References
Full explanation
Routing Tables, Forwarding Decisions, and Static Routes
Study guide · 200-301
Read the full explanation