Determine how a router chooses a route using longest prefix match, administrative distance and protocol metric.
Longest prefixADMetricRecursive lookupCEF
01 // Mental model
Start with the big picture.
The most specific matching prefix wins before route source or metric is considered.
CCNA focus: Always apply the hierarchy in order: longest prefix, then administrative distance for competing sources, then the routing protocol's metric.
02 // Building blocks
Know what each part does.
01
Longest prefix match
The most specific matching prefix wins before route source or metric is considered.
02
Administrative distance
If identical prefixes come from different sources, the lower trusted distance wins.
03
Metric
If the same protocol offers identical prefixes, its metric selects the best path.
04
Resolution
The router resolves the next hop to an exit interface and Layer 2 adjacency before forwarding.
03 // Compare and recognise
Read the clues.
Item
What to remember
/32 versus /24
A matching /32 host route wins because it is more specific.
Static versus OSPF
For the same prefix, default static AD 1 beats OSPF AD 110.
Two OSPF paths
The lower OSPF cost wins; equal costs can be installed together.
No specific match
A default route is used if present; otherwise the packet is dropped.
04 // Decision walkthrough
Decision walkthrough.
Packet destination: 10.20.30.42Known routes:10.0.0.0/8 via R210.20.0.0/16 via R310.20.30.0/24 via R40.0.0.0/0 via ISPSelected route: 10.20.30.0/24 via R4
Read the example from top to bottom, then verify the resulting state. Configuration is only complete when the output matches the intended design.
05 // Exam and troubleshooting
Turn facts into a method.
A matching /32 host route wins because it is more specific.
For the same prefix, default static AD 1 beats OSPF AD 110.
The lower OSPF cost wins; equal costs can be installed together.
A default route is used if present; otherwise the packet is dropped.
Exam checkpoint: Always apply the hierarchy in order: longest prefix, then administrative distance for competing sources, then the routing protocol's metric.
06 // Check yourself
Forwarding Decisions quiz.
1. Which route wins for 10.20.30.42 when /8, /16 and /24 all match?
2. When is administrative distance compared?
3. What happens if no route, including a default, matches?
4. What does a lower routing metric generally mean?