Linux Labs

Networking / Stage 12 of 14

Diagnosing between two machines

Not running Starting usually ~20 s
Leave the lesson

Step 3 of 7 · on a machine · 6 min

A specific route overrides the network

A single extra entry in the routing table can cut a machine off from a neighbour on the same network.

The rule from the routing lesson: when several entries match an address, the kernel takes the most specific one, with the longest prefix. A /32 entry describes one address and beats any network. A blackhole route says to drop packets to that address — silently, without trying to send them.

Exercise · look

Find the overriding route

Read the routing table of lab-node1 and ask the kernel which way it will send a packet to 192.0.2.12.

First, predict

What will ip route get 192.0.2.12 print on lab-node1?

Now start the exercise, run the command and compare your prediction with the output.

Sign in and start The machine is available after signing in

The curl error at the start of the lesson — Couldn't connect to server … after 0 ms — is the same as in the listening sockets lesson, but the cause differs: there the server refused, here the packet never left the client. ip route get on the client tells them apart.

You delete exactly that entry. ip route flush would also remove the connected network, and lab-node1 would lose its neighbour completely.

bash
sudo ip -n lab-node1 route del blackhole 192.0.2.12/32
sudo ip netns exec lab-node1 curl -sS -m 3 http://192.0.2.12:8080/health

Such an entry lives in kernel memory until a reboot. On a production server, after deleting it, find out who added it: network settings or a script will put it back.

Ubuntu 24.04
Loading…