Sub topic 3
Which tool manages your network configuration
This chapter assumes you can use a Linux shell and sudo, and that you know what an IPv4 address, prefix length, and default gateway are. It also assumes you have run the inspection commands from the previous chapter. The goal here is narrower: before you change any setting, find out which program owns the interface. If you edit the wrong file, nothing happens. Worse, two tools can fight over one interface.
Why the question matters
Linux has no single network configuration file. Several programs can configure an interface, and each reads its own files. A static address written into a Netplan file does nothing if NetworkManager has the interface in a different profile. A change made with ip address add works at once, but it is lost at reboot or when the owning tool next reapplies its configuration.
The symptoms of editing the wrong layer are consistent:
- The edit has no visible effect.
- The change works until the next reboot, then reverts.
- A file you did not touch is regenerated and overwrites your work.
All three come from the same cause: you changed something that is not the source of truth for that interface.
Two layers: front ends and backends
Many setups have two layers, and mixing them up causes most of the confusion.
- A front end is where you write the desired configuration. Examples are a Netplan YAML file, an
ifupdownfile at/etc/network/interfaces, or a NetworkManager connection profile. - A backend is the daemon that applies configuration to the kernel (it creates addresses and routes). The two common backends are
systemd-networkdand NetworkManager.
Netplan is purely a front end. It reads YAML and generates configuration for a backend, which Netplan calls a renderer. NetworkManager is both: it stores profiles and applies them itself.
The following table summarizes the tools you will meet.
| Tool | Layer | Configuration lives in | Typical systems |
|---|---|---|---|
| Netplan | Front end (generates backend config) | `/etc/netplan/*.yaml` | Ubuntu Server, many cloud images |
| systemd-networkd | Backend | `/etc/systemd/network/*.network`, generated files in `/run/systemd/network/` | Ubuntu Server (as Netplan renderer), minimal systemd systems |
| NetworkManager | Front end and backend | `/etc/NetworkManager/system-connections/` | RHEL family (8 and later), Fedora, Ubuntu Desktop, Debian Desktop |
| ifupdown | Front end and backend (shell-script based) | `/etc/network/interfaces` | Debian Server installs, older Ubuntu |
| wicked | Front end and backend | `/etc/sysconfig/network/` | SUSE family servers |
Two details are worth knowing. First, Red Hat family releases before version 9 stored profiles in legacy ifcfg-* files under /etc/sysconfig/network-scripts/. RHEL 9 and later use the keyfile format in the NetworkManager directory by default. Second, systemd-resolved often runs next to these tools, but it handles DNS only, not addresses. The resolver chapters cover it later.
How the pieces connect
On Ubuntu Server the chain is Netplan, then a renderer, then the kernel. On a Red Hat system there is no Netplan, and NetworkManager talks to the kernel directly.
Read the diagram from the top. Whatever you edit must be a box on the path that reaches the interface you care about.
Finding the tool on a running server
Do not guess from the distribution name. Distributions change defaults between releases, and cloud images and installers often differ from the standard install. Test the system instead, in four steps.
Step 1: See which daemons are running
Ask systemd which of the candidate services is active.
for unit in NetworkManager systemd-networkd networking wicked systemd-resolved; do
printf '%-20s %s\n' "$unit" "$(systemctl is-active "$unit" 2>/dev/null)"
donenetworking is the unit that runs ifupdown on Debian. A unit that does not exist is reported as inactive, so a result of inactive can mean "not installed". On a stock Ubuntu Server you will normally see systemd-networkd and systemd-resolved as active and NetworkManager as inactive. On a RHEL-family server, NetworkManager is active and most others are inactive.
If two backends are both active, look closer in the next step. That is allowed, but each must own different interfaces.
Step 2: Ask each backend what it manages
Running is not the same as managing. Each backend can list the interfaces it controls.
networkctl list
nmcli device statusIn networkctl list, the SETUP column shows configured for an interface that networkd manages and unmanaged for one it ignores. In nmcli device status, the STATE column shows connected (with a profile name in CONNECTION) when NetworkManager manages it, and unmanaged when it does not. If nmcli reports that NetworkManager is not running, that already answers the question for NetworkManager.
An interface should be configured in one tool and unmanaged in the other. If both claim it, expect conflicting addresses. If neither does, the interface has no configuration at all, or it is configured only by hand with ip.
Step 3: Look for front-end files
The files on disk show which front end holds the intended configuration.
ls -l /etc/netplan/ 2>/dev/null
ls -l /etc/NetworkManager/system-connections/ 2>/dev/null
grep -v '^\s*#' /etc/network/interfaces 2>/dev/nullThe 2>/dev/null hides errors for paths that do not exist, which is expected on any one system. If Netplan files exist, read them (as root) and check the renderer: line. Netplan defaults to networkd when the line is missing. If you have netplan 0.106 or later, netplan status also shows what each interface is using in practice.
sudo cat /etc/netplan/*.yaml
netplan statusIf /etc/network/interfaces contains iface enp1s0 inet static or inet dhcp lines, ifupdown holds the configuration for those interfaces.
Step 4: Confirm with the interface itself
Match the interface name from ip -br address show against what you found. A server with several interfaces can use different tools for different ones. For example, a management interface might be in a Netplan file while a secondary interface is handled by a NetworkManager profile left from an installer. Check each interface you plan to change.
Reading the evidence
Use the table to turn what you found into a conclusion.
| What you see | Conclusion | Where to edit |
|---|---|---|
| `/etc/netplan/*.yaml` exists, `renderer: networkd` or no renderer, networkd `active` | Netplan with systemd-networkd | The Netplan YAML file |
| `/etc/netplan/*.yaml` with `renderer: NetworkManager`, NetworkManager `active` | Netplan with NetworkManager | The Netplan YAML file (not `nmcli`, see below) |
| No Netplan files, NetworkManager `active`, interface `connected` | NetworkManager alone | `nmcli` or its profile files |
| `networking` unit active, `inet static` lines in `/etc/network/interfaces` | ifupdown | `/etc/network/interfaces` |
| `wicked` active | wicked | `/etc/sysconfig/network/ifcfg-*` |
The second row is a common trap. When Netplan uses NetworkManager as its renderer, Netplan generates NetworkManager profiles in /run/NetworkManager/system-connections/. If you then change one with nmcli, the next netplan apply can replace your edit. The Netplan file is the source of truth.
Gotchas
cloud-init regenerates the file
On cloud images, cloud-init often writes /etc/netplan/50-cloud-init.yaml from the platform's metadata on every boot. Your edits to that file can disappear after a restart. The file's header comment says so. To keep control of the network configuration, tell cloud-init to stop managing it, and put your own file in /etc/netplan/.
echo 'network: {config: disabled}' | sudo tee /etc/cloud/cloud.cfg.d/99-disable-network-config.cfgDo this deliberately. Once cloud-init stops managing the network, a change to the instance's network in the cloud console no longer reaches the guest.
Netplan files are merged in order
Netplan reads every *.yaml file in /etc/netplan/, in lexical order, and merges them. A later file overrides keys from an earlier one. If you add 01-static.yaml while 50-cloud-init.yaml still sets dhcp4: true for the same interface, the later file wins and DHCP stays on. Check the whole directory, not one file.
`ip` changes are temporary
Commands such as ip address add change the live kernel state only. They are useful for experiments and for recovery, but no tool records them. The next restart of the owning tool, or a reboot, removes them. Use them to test, then put the real setting into the tool that owns the interface.
Two managers on one interface
Running NetworkManager and systemd-networkd on the same interface produces addresses that appear and vanish. Pick one owner per interface. With Netplan this is a single renderer: value. With NetworkManager you can exclude an interface by marking it unmanaged. With networkd you can match interfaces by name in the .network file.
A package install can change the owner
Installing a desktop metapackage or network-manager on a server can bring in NetworkManager and change which tool is active. After such an install, repeat the checks in this chapter before you assume the earlier answer still holds.
Choosing a tool for a new server
If the distribution gives you a default, use it. The default has the best documentation and the fewest surprises, and it matches what colleagues will expect to find. If you must choose, these criteria help.
- Server with fixed wired interfaces, Ubuntu: Netplan with networkd. It has a small footprint and a declarative file you can keep in version control.
- Laptop, Wi-Fi, VPN profiles, or frequent changes: NetworkManager, because it handles interfaces that come and go.
- Red Hat family: NetworkManager. The tools, documentation, and support assume it.
- Debian server with simple needs:
ifupdownis acceptable, but a file-per-interface style is less capable for complex setups such as bonds and VLANs than the other options.
Switching a running remote server from one tool to another is risky. Prefer to switch during a build, or when you have console access.
Exercise
On a server, networkctl list shows enp1s0 as unmanaged, and nmcli device status shows it as connected with the connection "Wired connection 1". There is also a file /etc/netplan/50-cloud-init.yaml with renderer: networkd. Which tool owns the interface, and where should you make a static IP change?
Show answer
NetworkManager owns the interface, because networkd reports it unmanaged and NetworkManager reports it connected. The Netplan file is not in control of this interface, so editing it would have no effect here (and could mislead the next administrator). Make the change with nmcli connection modify "Wired connection 1" and reactivate the profile. Afterward, also review the Netplan file and either remove the stale interface entry or correct the renderer, so the configuration agrees with reality.
Exercise
You edit /etc/netplan/50-cloud-init.yaml on a cloud instance and the static address is gone after a reboot. What probably happened, and what is the fix?
Show answer
cloud-init regenerated the file from the platform metadata at boot. To make your configuration persist, create /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg containing network: {config: disabled}, then keep your configuration in a separate Netplan file of your own, for example /etc/netplan/01-static.yaml. Remember that the old 50-cloud-init.yaml may still be merged, so remove or neutralize any conflicting entries for the same interface.