Networking Configuration
Networking Configuration tests interface addressing, routing, name resolution and troubleshooting with modern Linux tools, including how to make runtime changes persistent.
Core commands and persistence
ip linkshows interfaces;ip addr add 192.0.2.10/24 dev eth0adds an address;ip route add default via 192.0.2.1sets a gateway.ip -s linkexposes errors and drops;ss -tulpnlists listeners;ping,traceroute, anddigisolate layers.- Persistence depends on the stack: Debian
ifupdownuses/etc/network/interfaces; NetworkManager usesnmcli con mod; systemd-networkd uses.networkfiles. - Name resolution order comes from
/etc/nsswitch.conf;/etc/hostsis consulted before DNS if configured;/etc/resolv.confis often overwritten by DHCP or a manager. ip route showdisplays connected, static, and default routes; persistent routes belong in the distro's configuration, not only the running kernel.
Worked example
A host reaches its own subnet but not 198.51.100.0/24. ip addr shows 192.0.2.10/24; ip route contains only 192.0.2.0/24. Add ip route add 198.51.100.0/24 via 192.0.2.1, test with ping, then persist the route in the network configuration. Reasoning: the connected route covers only the local prefix; without a specific or default route, packets have no next hop. If a default route exists, check firewall and reverse-path filtering.
Traps
- Assuming
ipchanges survive reboot. - Expecting hand-edited
/etc/resolv.confto survive DHCP. - Mixing NetworkManager and ifupdown on one interface.
- Confusing a down interface with a missing address.