Hands-on Lab·Linux Foundation Certified System Administrator
Routes, and where a packet goes
Reading a routing table is the skill that separates guessing from diagnosing. This guide shows the table on a real host, then builds a second one inside a network namespace so routes can be added and removed freely, and demonstrates the longest-prefix rule that decides which line wins.
Networking Guide 23 of 38 Intermediate
- OSUbuntu 26.04 LTS
- LVM2.03.31 (Ubuntu) / 2.03.36 (AlmaLinux)
- nftables1.1.6 (Ubuntu) / 1.1.5 (AlmaLinux)
- TimeAbout 14 min
iproute2, identical on both families. The mutating half runs inside a network namespace so the host's own routing is never at risk.
- Firewallufw 0.36.2 enabled but reporting inactive / firewalld active
- Network confignetplan + systemd-networkd / NetworkManager 1.56.0
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| LFCS-A01 | 192.168.0.70 | Ubuntu 26.04 LTS | Primary host - most guides run only here | 2 Core | 4 GB | 50 GB |
This guide includes
Use this because reading a routing table separates diagnosis from guessing. This matters because you can ask the kernel which line it would pick, rather than working it out and hoping.
- reading the three lines this host actually uses
- experimenting in a second table, inside a namespace
- adding a more specific route, and asking which rule wins
- asking the same question on the real host, safely
Before you start
- guide 23 - the namespace built there is reused here.
-
The table this host actually uses
-
A second table, to experiment in
-
The rule that picks a line
-
The same question on the real host