Linux Labs

Networking / Stage 3 of 14

Persistent networking with Netplan

Not running Starting usually ~20 s
Leave the lesson

Step 1 of 9 · on a machine · 5 min

The fix is gone

What you will learn

  • Tell an interface's current address apart from the persistent configuration in Netplan.
  • Read and fix a Netplan YAML file and check it before applying it.
  • Apply the configuration and check it in the file, on the interface and by an exchange with the neighbour.

Yesterday the lab0 interface ended up with 192.0.3.10/24 instead of 192.0.2.10/24. A colleague fixed it with the ip command, and the neighbour 192.0.2.1 started answering. Today the network configuration was restarted. Repeat that yourself.

lab0 is an interface of the machine itself: commands for it are written without -n. Start on the card prepares the machine.

Exercise · look

The fix before and after the restart

Check ping to the neighbour, restart the network configuration with sudo netplan apply, then look at the address of lab0 and check ping again.

First, predict

Right now lab0 has the colleague's address, 192.0.2.10/24. Which address will ip show after sudo netplan apply?

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
Check yourself 1 question

Why does lab0 have 192.0.3.10/24 again after sudo netplan apply?

  • The colleague's command worked: before the restart the neighbour answered the first ping.

  • Such an address has no expiry: it lasts until the network is configured again. Here sudo netplan apply replaced it within a minute.

  • What changed was the address of lab0 on this machine, as the ip output after the restart shows.

sudo netplan apply configured lab0 from the file, and the file says 192.0.3.10/24.

Ubuntu 24.04
Loading…