Router Forwarding: Longest Prefix Match Logic
Short answer
C The router forwards the packet via prefix 172.31.0.0/25 because it is the longest matching prefix.
Question
packet: prefixes 172.31.0.0/16, 172.31.0.0/24, and 172.31.0.0/25. How does the router handle the packet?
Key Takeaways
Tests the Longest Prefix Match rule where the router prioritizes the most specific route (longest subnet mask) over less specific ones.
A router forwarding a packet to 172.31.0.1 with multiple matching routes (/16, /24, /25) selects the longest prefix match, which is /25.
Common mistake: Choosing A (/24) or B (/16) because they are 'larger' networks or appear first; however, specificity dictates the choice, not size or order.
Expert Analysis
Longest Prefix Match Rule
The router selects the route with the longest subnet mask that matches the destination IP address. This is known as the Longest Prefix Match rule.
Analysis of Options
- 172.31.0.0/25: Mask /25 (longest) covers 172.31.0.0 to 172.31.0.127. Host.1 is in this range.
- 172.31.0.0/24: Mask /24 covers 172.31.0.0 to 172.31.0.255. Host.1 is in this range.
- 172.31.0.0/16: Mask /16 covers 172.31.0.0 to 172.31.255.255. Host.1 is in this range.
- 0.0.0.0/0: Default route, but specific routes are preferred.
Since all three specific routes match, the router chooses the one with the most bits: /25.
Operational Consequence
If you choose a shorter prefix (like /24 or /16), traffic will be misrouted to a less specific network, potentially causing connectivity issues or security breaches if the /25 network was intended for isolation.
Decision Context
This tests knowledge of routing table lookup mechanics (Objective 3.2). Changing the destination to 172.31.0.200 would still match /24 and /16, but not /25, flipping the answer to B.
Exam Strategy
When facing routing questions with multiple valid routes, always compare the subnet masks. The correct answer is invariably the one with the highest number of bits (longest mask). Do not consider administrative distance unless the prefixes are identical.
Frequently Asked Questions
Why doesn't the router use the default gateway?
What if two routes have the same prefix length?
Community Votes
100% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 3 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 3
-
Goh0503 👍 14Answer: C how a router makes a forwarding decision by a Longest match >>b Administrative distance >>c Routing protocol metric, in this order
-
maximus_007 👍 1 Answered CProbably one of the easiest questions related to longest prefix. Sheeeesh!
-
2b081f1 👍 1 Answered Cc is correct
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All 200-301 Questions
Access 220 questions with complete answers and detailed explanations.
View Full 200-301 Practice Test →