Linux Labs

Networking / Stage 2 of 14

How Linux picks a route

Not running Starting usually ~20 s
Leave the lesson

Step 3 of 7 · on a machine · 4 min

A route to a single address

Now you can tell the client where to send packets for the service: via the neighbour that holds that address.

ip route add adds a route. A single address is written with the /32 prefix, a subnet of one host:

text
ip route add DESTINATION/PREFIX via GATEWAY dev INTERFACE

The same sudo ip -n lab-client takes the command into the client's namespace. If the line already exists, ip prints RTNETLINK answers: File exists and leaves the table as it is.

Exercise · do it

A way to the service

In lab-client, add a route to the single address 198.51.100.20 via the neighbour 192.0.2.1 and check that the service answers ping. Do not change addresses and do not add a default route.

Sign in and start The machine is available after signing in

Goals · 0 of 2

  • Add a route to 198.51.100.20 via the neighbour not done yet
  • Get 198.51.100.20 to answer ping not done yet

Step goals

0 of 2
  • Add a route to 198.51.100.20 via the neighbour — not done yet
  • Get 198.51.100.20 to answer ping — not done yet
Ubuntu 24.04

Step goals

0 of 2
  • Add a route to 198.51.100.20 via the neighbour — not done yet
  • Get 198.51.100.20 to answer ping — not done yet
Loading…