After a restart the address comes from a Netplan file — a short description of the interfaces in YAML.
Netplan keeps Ubuntu's network configuration in the files /etc/netplan/*.yaml. It configures the interfaces from them at boot and on the netplan apply command. The file can only be read with sudo: it has -rw------- permissions and belongs to root, since network settings may contain passwords.
Here is /etc/netplan/50-lab.yaml from the first exercise, as sudo cat prints it:
The file is written in YAML: indentation with spaces sets the nesting, and a line starting with - is a list item.
| Key | What it sets |
|---|---|
ethernets: → lab0: |
the settings of the lab0 interface |
renderer: networkd |
who applies the configuration |
dhcp4: false |
do not get an address automatically |
addresses: |
a list of addresses with prefixes |
The renderer is the service that receives the ready configuration from Netplan and sets it on the interface. Here it is systemd-networkd.
After a restart lab0 must have 192.0.2.10/24. What do you change?
-
The renderer chooses who applies the configuration; the address itself is written under
addresses. -
The first exercise showed that an address set with
iplasts only until the nextnetplan apply. -
DHCP hands out addresses automatically, but it will not pick the
192.0.2.10/24you need. The interface's address is set by theaddresseslist.
After a restart the address comes from the addresses list of the Netplan file. That is what you fix, and then you apply the file.
Key points
-
Ubuntu's persistent network configuration is the files
/etc/netplan/*.yaml, readable only withsudo. -
Indentation sets the nesting in YAML, and the interface's addresses are the
addresseslist with prefixes. -
The renderer sets the configuration on the interface; here it is the
systemd-networkdservice.