Persistent network configuration

Intermediate · 12 min

NetworkManager, systemd-networkd and netplan: which distribution uses which, how to tell who owns an interface, and how to change it safely.

Before thisInterfaces, addresses and the ip commandRouting and the default gatewayName resolution on LinuxUnits, targets and dependencies

KeepItTechie · 12 min

Persistent network configuration

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by KeepItTechieReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • The kernel forgets every address and route at reboot. A network manager daemon reapplies them from configuration files at boot. Each interface should have exactly one owner.
  • NetworkManager, driven by `nmcli`, is the default on the RHEL family and on desktops. Its profiles live as keyfiles in `/etc/NetworkManager/system-connections/`. RHEL 10 no longer reads the old `ifcfg` files.
  • systemd-networkd reads `.network` files from `/etc/systemd/network/`, each matching interfaces and listing addresses, gateways and DNS servers. `networkctl` shows its view.
  • Netplan, used by Ubuntu, is not a daemon. It reads YAML from `/etc/netplan/` and generates configuration for networkd (the default renderer) or NetworkManager.
  • On a remote machine use a change path that can roll back, such as `netplan try`, which reverts after 120 seconds unless you confirm.

The kernel has no memory

In the last three lessons you added addresses and routes with ip, and each time the same warning came up: it is gone after a reboot. The kernel holds network state in memory only. Something has to read a configuration file at boot and tell the kernel again, and keep telling it as DHCP leases renew, cables come and go and VPNs connect.

That something is a network manager, a daemon started by systemd early in boot. Linux has several, and every distribution picked differently. That is the real difficulty of this topic. The commands are easy once you know which tool is in charge on the box in front of you.

One owner per interface

The rule that saves the most pain: every interface has exactly one manager. Two daemons each trying to configure enp5s0 produce flapping addresses, duplicate routes and DNS servers that change by themselves. It is like two people sharing one calendar and both rescheduling the same meeting. Each tool has a way to leave an interface alone, and on a well-built server the others are not running at all.

NetworkManager and nmcli

NetworkManager is the default on Fedora, RHEL, Rocky and Alma, and on almost every desktop. It thinks in connection profiles: a named bundle of settings that can be activated on a device.

nmcli device status                       # devices and which profile is active
nmcli connection show                     # saved profiles
sudo nmcli connection modify "Wired connection 1" \
  ipv4.method manual ipv4.addresses 192.0.2.10/24 \
  ipv4.gateway 192.0.2.1 ipv4.dns 192.0.2.53
sudo nmcli connection up "Wired connection 1"

modify changes the saved profile only. up applies it. Profiles are stored as INI-style keyfiles under /etc/NetworkManager/system-connections/. Red Hat’s RHEL 10 documentation states that profiles in the old ifcfg format are not supported there, are ignored, and cannot be converted on RHEL 10 itself, so convert with nmcli connection migrate on RHEL 9 before upgrading.

systemd-networkd

systemd-networkd is the smaller, server-minded option. It reads files ending in .network from /etc/systemd/network/:

# /etc/systemd/network/10-uplink.network
[Match]
Name=enp5s0

[Network]
Address=192.0.2.10/24
Gateway=192.0.2.1
DNS=192.0.2.53

[Match] picks interfaces, by name, MAC address or driver. [Network] says what to apply. DNS servers listed here are handed to systemd-resolved, the stub from the name resolution lesson. networkctl lists links and whether networkd manages them. It is a normal systemd service, so everything from units, targets and dependencies applies, including the systemd-networkd-wait-online service that holds back units ordered after network-online.target.

Netplan, Ubuntu’s front end

Ubuntu adds a layer. You write YAML in /etc/netplan/, and netplan turns it into configuration for a renderer. The netplan reference lists two, networkd (the default) and NetworkManager. Ubuntu Server uses the first, Ubuntu Desktop the second. A static setup, following the reference:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp5s0:
      addresses: [192.0.2.10/24]
      routes:
        - to: default
          via: 192.0.2.1
      nameservers:
        addresses: [192.0.2.53]

The reference notes that the older gateway4 key is deprecated in favour of routes, which matters because many tutorials still use it. netplan generate writes the backend files, netplan apply applies them, and netplan try applies them and rolls back after 120 seconds unless you confirm. Over SSH, try is the one to use.

Netplan reads /lib/netplan, /etc/netplan and /run/netplan. Its docs say /run wins, then /etc, and a same-named file in /run replaces the one in /etc entirely. Cloud images often have a 50-cloud-init.yaml written by cloud-init. Edit around it with care, since cloud-init may rewrite it.

Which distribution uses what

System Default manager Where to look
RHEL 9/10, Fedora, Rocky, Alma NetworkManager nmcli, /etc/NetworkManager/system-connections/
Ubuntu Server netplan → systemd-networkd /etc/netplan/*.yaml
Ubuntu Desktop netplan → NetworkManager /etc/netplan/, nmcli
Debian, plain install ifupdown /etc/network/interfaces
Debian cloud images netplan → systemd-networkd /etc/netplan/50-cloud-init.yaml
Arch, minimal containers whatever you install often systemd-networkd

The Debian rows come from Debian mailing-list and cloud-team discussions rather than a single official page, so check /etc/os-release and the files above on the real box. On an unfamiliar machine run systemctl is-active NetworkManager systemd-networkd networking and look for the files. The one that exists and is active is the owner.

None of these commands were run. There is no Linux machine here, and the examples are written from the netplan, systemd and Red Hat documentation, checked 2026-11-28.

About the video

The embed is all of KeepItTechie’s “How to Set a Static IP on Ubuntu Server 26.04 | Netplan Tutorial”, November 2026, about 12 minutes. Its description says it configures a permanent IPv4 address, default gateway and DNS servers with netplan on the current Ubuntu release and then verifies them. It is Ubuntu-only. The NetworkManager side is the five-minute Red Hat video in deeper, and the networkd files and the “who owns this interface” question are this lesson’s own. I judged the video from title and description. English was judged from the English auto-caption track.

Where this fits

The machine now keeps its addresses across reboots. Next, what is listening on them: sockets and listening ports with ss.

Check yourself

  1. 01On an Ubuntu server you edit a file in `/etc/systemd/network/`, but your change seems to be ignored or overwritten. What is a likely reason?

    Netplan generates networkd configuration from `/etc/netplan/*.yaml`, and its generated files can take precedence for the same interface. Make the change in the netplan YAML instead.

  2. 02How can you tell which tool manages an interface on an unfamiliar box?

    Check which services are active (`systemctl is-active NetworkManager systemd-networkd`), look for files in `/etc/netplan/`, `/etc/NetworkManager/system-connections/` and `/etc/network/interfaces`, and see whether `nmcli device` or `networkctl` lists the interface as managed.

  3. 03You change a NetworkManager connection with `nmcli connection modify`. Why doesn't the address change straight away?

    Modifying a profile changes the saved configuration, not the live interface. Reactivate it with `nmcli connection up <name>` to apply it.

  4. 04Why is `netplan try` safer than `netplan apply` over SSH?

    It applies the new configuration and rolls it back automatically if you do not confirm within the timeout, so a mistake that cuts off your session undoes itself.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark