Linux Labs

Networking / Stage 3 of 14

Persistent networking with Netplan

Not running Starting usually ~20 s
Leave the lesson

Step 5 of 9 · theory · 4 min

Three checks of the result

A successful command does not yet mean the network is configured. The result is checked in three places.

Check What it catches
the merged configuration: sudo netplan get an extra file, a wrong address
the address on the interface: ip -brief -4 address show dev lab0 the configuration was not applied
the exchange with the neighbour: ping -c 2 -W 1 192.0.2.1 the path or the neighbour

A correct file with the old address on the interface means apply was not run. A correct address with a wrong file lasts until the next apply or reboot, as you saw in the first exercise. Both are correct and the neighbour is silent: look for the cause in the routes and on the neighbour's side, not in the file.

Check yourself 1 question

After an edit, sudo netplan generate ran without errors. What does that prove?

  • generate does not touch interfaces: in the exercise the address changed only after apply. ip -brief -4 address show dev lab0 shows the current one.

  • generate checks the notation, not the intent: to it, 192.0.3.10/24 is just as valid an address. sudo netplan get shows what is written.

  • generate does not check the exchange with the neighbour; ping -c 2 -W 1 192.0.2.1 does.

generate checks that the files are written correctly and prepares the configuration for networkd. The address on the interface and the exchange with the neighbour are checked with ip and ping.

Key points

  • A network configuration is checked three times: the result in netplan get, the address in ip and the exchange in ping.
  • A correct address with a wrong file disappears at the next apply.
Ubuntu 24.04
Loading…