A host's routing table holds exactly these four entries: `default via 192.0.2.1 dev eth0`, `10.0.0.0/8 via 192.0.2.20 dev eth0`, `10.4.0.0/16 via 192.0.2.30 dev eth0` and `10.4.7.0/24 dev eth1 scope link`. How does the kernel forward a packet addressed to 10.4.7.9?

LPIC-1 Exam 102-500, objective 109. Networking fundamentals hard

Machine-checked — no person has signed for it. This question was read against the source cited below by an automated pass, which found no contradiction. That is a weaker claim than it sounds: the same kind of process wrote the question, so it can confirm its own mistake.

Treat it as a good draft rather than as settled fact, and read the source below before you rely on it. It is not used in mock exams here — only questions a person has signed for are.

How these questions are written — where each question comes from, what the verification ledger records, and what happens when one is found wrong.

The options

Correct Directly out of eth1, with no gateway, resolving 10.4.7.9 by ARP on that link

Correct. 10.4.7.0/24 is the longest prefix that matches 10.4.7.9, and that entry has no via clause, so the destination is treated as on-link and reached by ARP on eth1.

Not correct Via 192.0.2.30 out of eth0, because that route was added for the 10.4 network

Wrong. 10.4.0.0/16 does match the address, but it is a shorter prefix than 10.4.7.0/24, and the kernel always prefers the most specific matching route.

Not correct Via 192.0.2.20 out of eth0, because 10.0.0.0/8 covers the whole private range

Wrong. /8 is the least specific of the three matching entries, so it only handles 10.x.x.x destinations that no narrower route matches.

Not correct Via 192.0.2.1, since the destination is not on a directly connected subnet

Wrong on both counts. The default route is 0.0.0.0/0, the shortest possible prefix, and is used only when nothing else matches; here the /24 entry also shows the destination is directly connected on eth1.

Why

Route selection is longest-prefix match: among all entries whose prefix contains the destination, the kernel takes the one with the largest prefix length, and the default route (0.0.0.0/0) therefore acts purely as a fallback. A route with a via clause forwards to that next-hop router; a route without one, shown with `scope link`, declares the network directly reachable, so the destination's own hardware address is resolved on that interface. `ip route get 10.4.7.9` makes the kernel state the selected route rather than requiring you to compare prefixes manually.

Where this comes from

Cited
manual page ip-route(8)

Practise this

Reading one question is not practice. The trainer will draw a short set from objective 109 and space the ones you get wrong.

Practise LPIC-1 Exam 102-500

More questions on this objective

All questions on Networking fundamentals

Practise LPIC-1 Exam 102-500