Octet

What are netplan, systemd-networkd and NetworkManager, and how do you tell which one manages a host?

Show the answer

Say this first

systemd-networkd and NetworkManager are daemons that configure interfaces, addresses, routes and DNS. Netplan, on Ubuntu, is only a YAML front end: it renders its files into config for networkd (the default on Ubuntu Server) or NetworkManager (Ubuntu Desktop) and does nothing at runtime. RHEL and Fedora use NetworkManager with nmcli. Anything done with ip is temporary; the daemon's config is what survives a reboot. networkctl list and nmcli device status show who manages each interface.

Go deeper

Netplan (Ubuntu)

YAML
# /etc/netplan/01-netcfg.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    ens192:
      addresses: [10.0.10.21/24]
      routes:
        - to: default
          via: 10.0.10.1
      nameservers:
        addresses: [10.0.20.53, 10.0.20.54]
        search: [corp.example.com]

netplan try applies it and rolls back after 120 seconds unless you confirm, which is the safe way over SSH. netplan apply applies without a safety net. gateway4 is deprecated; use a route to: default.

systemd-networkd

Output
$ networkctl list
IDX LINK   TYPE     OPERATIONAL SETUP
  1 lo     loopback carrier     unmanaged
  2 ens192 ether    routable    configured

2 links listed.

Native files are /etc/systemd/network/*.network with [Match], [Network] and [Link] sections; networkctl status ens192 shows addresses, gateway, DNS and recent log lines.

NetworkManager

Shell
nmcli device status
nmcli con mod ens192 ipv4.method manual ipv4.addresses 10.0.10.21/24 ipv4.gateway 10.0.10.1 ipv4.dns "10.0.20.53 10.0.20.54"
nmcli con up ens192

Connections are stored as keyfiles in /etc/NetworkManager/system-connections/. RHEL 9 deprecated the old ifcfg files. The connection name and the device name can differ: nmcli con show lists both.

Traps

  • Editing the files netplan generates under /run. They are rewritten on the next netplan apply or boot.
  • Running netplan apply on a remote box with a typo instead of netplan try.
How did you do?