Linux Labs

Networking / Stage 3 of 14

Persistent networking with Netplan

Not running Starting usually ~20 s
Leave the lesson

Step 3 of 9 · on a machine · 6 min

Check, then apply

The network does not pick up an edited file straight away: one Netplan command checks it, another applies it.

sudo netplan generate reads the files and writes the ready configuration for networkd into /run/systemd/network/. It does not touch the interfaces. An error in a file is reported with its line and column: 50-lab.yaml:8:9: … address '192.0.2.10' is missing /prefixlength means the address on line 8 has no prefix.

sudo netplan apply does the same and also hands the configuration to networkd, so the address on the interface changes. Without errors, both commands print nothing.

Keep the file's permissions as they are: when the file is open to everyone, Netplan prints the warning Permissions for /etc/netplan/… are too open.

Exercise · look

Generate, then apply

The file /etc/netplan/50-lab.yaml is already fixed: it says 192.0.2.10/24. Run sudo netplan generate and look at the address of lab0, then sudo netplan apply, and look again.

First, predict

The file is already fixed. Which address will ip show for lab0 right after sudo netplan generate?

Now start the exercise, run the command and compare your prediction with the output.

Sign in and start The machine is available after signing in
Ubuntu 24.04
Loading…