Netplan renderer transition from NetworkManager to systemd-networkd
0 reputation · 26 Aug 2021, 05:47 UTC
0 reputation · 26 Aug 2021, 05:47 UTC
Ubuntu 18.04 LTS and subsequent versions utilize Netplan to abstract network configuration via YAML files. A key design decision involves selecting the backend renderer, typically choosing between systemd-networkd for server environments and NetworkManager for desktop or dynamic setups.
When transitioning a production interface from NetworkManager to systemd-networkd to reduce overhead or standardize server behavior, there is uncertainty regarding the coexistence of these renderers. Specifically, the interaction between a global renderer setting and interface-specific overrides can lead to conflicting routing tables or unpredictable interface states if not handled precisely.
1. Conflict resolution
/etc/netplan/*.yaml files, merges them, and then applies the renderer key.renderer specified at the top level of a file is considered the *global* renderer. Any interface that has its own renderer key overrides the global value.NetworkManager.service when using systemd-networkd, or vice‑versa).2. Existing DHCP leases when switching
netplan apply is executed, the target renderer restarts its networking daemon. For systemd-networkd, this means the daemon reloads its configuration, releases any existing DHCP lease on the interface, and immediately requests a new lease.Backup the current configuration:
sudo cp /etc/netplan/*.yaml /etc/netplan/*.yaml.bak
Open the YAML file(s) you use for the interface you want to switch. Add or change the global renderer:
network:
version: 2
renderer: systemd-networkd
ethernets:
eth0:
dhcp4: true
renderer: systemd-networkd # optional, overrides global
Validate the syntax:
sudo netplan try
This will apply the config for 120 s and revert if you abort. If the test succeeds, proceed.
Disable the other renderer:
sudo systemctl stop NetworkManager
sudo systemctl disable NetworkManager
sudo systemctl mask NetworkManager
Ensure systemd-networkd is installed and enabled:
sudo apt-get install systemd-networkd # if missing
sudo systemctl enable --now systemd-networkd
Apply the configuration permanently:
sudo netplan apply
Verify the interface:
ip addr show eth0
systemctl status systemd-networkd
Reboot to confirm the state persists across reboots.
nmcli or NetworkManager‑specific settings (e.g., VPN, Wi‑Fi) remain in the YAML. They will be ignored by systemd-networkd but can cause confusion.systemd-networkd-wait-online.service, confirm that it starts after the network is up; otherwise, services that depend on networking may start too early./var/log/syslog for errors from systemd-networkd after the switch.To tailor the recommendation precisely, could you confirm whether systemd-networkd is already installed and enabled on your machine?
systemd-networkd-wifi or systemd-networkd-wifi.service).Use comments to ask for clarification. Post a solution as an answer.
31,775 reputation · 26 Aug 2021, 16:10 UTC
Netplan resolves renderer conflicts through a clear precedence model: a renderer specified under a specific device (e.g., ethernets: eth0: renderer: networkd) overrides the top-level network: renderer: NetworkManager default for that device only. All other devices fall back to the global renderer.
Crucially, Netplan generates backend configuration only for the assigned renderer. A networkd-managed device gets files under /run/systemd/network/, while NetworkManager-managed devices receive keyfiles under /run/NetworkManager/system-connections/. This architectural separation means both daemons can coexist managing disjoint sets of interfaces without conflict.
However, conflicts only occur if both daemons are told to manage the same interface—typically from leftover NetworkManager config or wildcard matches in another YAML file. Netplan apply does not automatically purge stale NetworkManager profiles for interfaces you reassign, so manual cleanup is essential.
netplan apply, run networkctl list and nmcli device status to confirm each interface is owned by exactly one rendererip route show and ensure no interface has conflicting configuration files