Routing Table — Pick the Next-Hop
Easy Networking · 15 min
Routing Table — Pick the Next-Hop
Scenario
A router has the routing table shown on the right. A packet arrives destined for 10.4.17.42. Which next-hop does the router forward it to?
Rule — Longest Prefix Match
When multiple routes match, the one with the longest (most specific) prefix wins. Administrative distance and metric only tie-break when prefix lengths are equal.
Answer format
Submit the next-hop IP address only, lowercase:
192.0.2.5
(Example shape — not the answer.)
Steps
- Convert
10.4.17.42to binary (or just compare octets). - For each route, check whether the destination falls inside that prefix.
- Pick the candidate with the longest prefix (biggest
/N).
Hints
Hint 1 (−10 pts)
Discard any routes whose prefix doesn't cover 10.4.17.42 at all. The default route 0.0.0.0/0 always matches but has the shortest prefix — it's the last resort.
Hint 2 (−10 pts)
10.4.16.0/22 covers 10.4.16.0–10.4.19.255 → matches. 10.4.0.0/16 also matches but is shorter (/16 < /22). 10.0.0.0/8 even shorter. /22 wins.
Hint 3 (−10 pts)
Answer: 203.0.113.2 (the next-hop on the 10.4.16.0/22 route).
Lab environment · sandboxed iframe · auto-resets every 60 min