ip route get shows which line of the table the kernel picks for an address. It sends no packets.
With the route from the exercise, the answer for the service is:
The packet leaves through lab0 to the gateway 192.0.2.1 with the source address 192.0.2.10. uid 0 and cache are service fields that do not affect the path. With no matching line, ip route get prints RTNETLINK answers: Network is unreachable.
ip route get describes the client's decision; whether the packet arrived is what ping shows. A reply also needs a way back: the server sends it by its own table. Here the client is the server's neighbour in 192.0.2.0/24, so the way back exists by itself.
ip route get 198.51.100.20 printed 198.51.100.20 via 192.0.2.1 dev lab0 src 192.0.2.10. What follows from this?
Several options are correct.
-
ip route getsends no packets; it describes the choice of path.pingshows whether the host answers. -
This is the client's table speaking. The server sends its reply by its own table, which you read on the server:
sudo ip -n lab-server route.
ip route get shows the client kernel's decision: the gateway, the interface and the source address. Whether the packet arrived and a reply came back is what ping checks.
Key points
-
ip route get ADDRESSshows the chosen path: gateway, interface and source address. -
ip route getsends no packets;pingchecks the exchange. - The reply comes back by the other side's routing table.