Fix
IP address and routes are gone after a reboot
Settings made with ip addr and ip route live only in the running kernel. Write them to the system's network configuration so they are applied at boot.
Likely causes
- The address and routes were set with
ipcommands only, never written to a file. - They were written, but to a file this system does not read (ifupdown, netplan and NetworkManager each have their own), or with a mistake in it.
Diagnose
Run these in order. The output is what each printed on a lab's real Linux machines.
-
laptop:~# ip addr show eth0 - After the restart the card is
DOWNwith noinetline: no address.11: eth0@if60211: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default link/ether 6e:a3:88:cd:55:09 brd ff:ff:ff:ff:ff:ff link-netnsid 0 altname homeNetwork -
laptop:~# ip route - And the routing table is empty.
Fix
-
/etc/network/interfaces - On a Debian-style system (ifupdown), the card's address, mask, gateway and DNS server go in
/etc/network/interfaces.auto eth0 iface eth0 inet static address 10.0.1.10 netmask 255.255.255.0 gateway 10.0.1.2 dns-nameservers 10.0.1.2 -
laptop:~# ip route - After the next restart, the routes come back by themselves.
default via 10.0.1.2 dev eth0 10.0.1.0/24 dev eth0 proto kernel scope link src 10.0.1.10
-
laptop:~# curl -sS -m 5 http://webServer.lab/ - And the page loads by name.
hello from webServer
Break it and fix it yourself
Each lab is a small network of real Linux machines in your browser, where this fault happens.
- A bare machine: networking by hand : its challenge "Written down, still lost at boot" set the fault for you to find and fix.