We recently got an error indicating that systemd-networkd
is not supported in the deployment of CRC – CodeReady Containers on Ubuntu Linux. systemd-networkd is a network management tool that replaces the network scripts traditional method of setting up networking on Ubuntu.
In this post we show you how to switch to NetworkManager network configuration tool from systemd-networkd. First confirm if systemd-networkd
is running:
$ systemctl status systemd-networkd.service
● systemd-networkd.service - Network Configuration
Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled; preset: enabled)
Active: active (running) since Tue 2024-07-16 20:26:56 UTC; 6min ago
TriggeredBy: ● systemd-networkd.socket
Docs: man:systemd-networkd.service(8)
man:org.freedesktop.network1(5)
Main PID: 712 (systemd-network)
Status: "Processing requests..."
Tasks: 1 (limit: 38473)
FD Store: 0 (limit: 512)
Memory: 3.1M (peak: 3.3M)
CPU: 29ms
CGroup: /system.slice/systemd-networkd.service
└─712 /usr/lib/systemd/systemd-networkd
Jul 16 20:26:56 noble systemd[1]: Starting systemd-networkd.service - Network Configuration...
Jul 16 20:26:56 noble systemd-networkd[712]: lo: Link UP
Jul 16 20:26:56 noble systemd-networkd[712]: lo: Gained carrier
Jul 16 20:26:56 noble systemd-networkd[712]: Enumeration completed
Jul 16 20:26:56 noble systemd[1]: Started systemd-networkd.service - Network Configuration.
Jul 16 20:26:56 noble systemd-networkd[712]: ens3: Configuring with /run/systemd/network/10-netplan-ens3.network.
Jul 16 20:26:56 noble systemd-networkd[712]: ens3: Link UP
Jul 16 20:26:56 noble systemd-networkd[712]: ens3: Gained carrier
Jul 16 20:26:56 noble systemd-networkd[712]: ens3: DHCPv4 address 188.40.183.239/27, gateway 188.40.183.225 acquired from 188.40.183.226
Jul 16 20:26:58 noble systemd-networkd[712]: ens3: Gained IPv6LL
Step 1: Set NetworkManager as netplan renderer
List netplan configuration files.
$ ls /etc/netplan/
50-cloud-init.yaml
You can list contents of the default file.
$ cat /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
version: 2
ethernets:
ens3:
dhcp4: true
match:
macaddress: fa:16:3e:69:e3:05
set-name: ens3
Open the .yaml config file and set renderer to NetworkManager after version:
$ sudo nano /etc/netplan/50-cloud-init.yaml
network:
version: 2
renderer: NetworkManager
Step 2: Install Install NetworkManager
Run the following commands to install NetworkManager.
sudo apt update && sudo apt install network-manager
Disable and mask systemd-networkd
services.
sudo systemctl disable systemd-networkd.service systemd-networkd.service
sudo systemctl mask systemd-networkd.service systemd-networkd.socket
Start and enable NetworkManager service.
sudo systemctl enable NetworkManager
sudo systemctl start NetworkManager
Step 3: Generate netplan config and reboot system
Generate netplan backend configuration files for NetworkManager:
sudo netplan generate
Reboot your Ubuntu system.
sudo reboot
After the reboot check NetworkManager service.
$ systemctl status NetworkManager
● NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; preset: enabled)
Active: active (running) since Tue 2024-07-16 20:55:11 UTC; 1min 45s ago
Docs: man:NetworkManager(8)
Main PID: 766 (NetworkManager)
Tasks: 4 (limit: 38473)
Memory: 14.5M (peak: 31.0M)
CPU: 316ms
CGroup: /system.slice/NetworkManager.service
└─766 /usr/sbin/NetworkManager --no-daemon
Jul 16 20:55:11 noble NetworkManager[766]: <info> [1721163311.0317] dhcp4 (ens3): state changed new lease, address=188.40.183.239, acd pending
Jul 16 20:55:11 noble NetworkManager[766]: <info> [1721163311.1587] dhcp4 (ens3): state changed new lease, address=188.40.183.239
Jul 16 20:55:11 noble NetworkManager[766]: <info> [1721163311.1590] policy: set 'netplan-ens3' (ens3) as default for IPv4 routing and DNS
Jul 16 20:55:11 noble NetworkManager[766]: <info> [1721163311.1621] device (ens3): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Jul 16 20:55:11 noble NetworkManager[766]: <info> [1721163311.1632] device (ens3): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Jul 16 20:55:11 noble NetworkManager[766]: <info> [1721163311.1633] device (ens3): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Jul 16 20:55:11 noble NetworkManager[766]: <info> [1721163311.1636] manager: NetworkManager state is now CONNECTED_SITE
Jul 16 20:55:11 noble NetworkManager[766]: <info> [1721163311.1638] device (ens3): Activation: successful, device activated.
Jul 16 20:55:11 noble NetworkManager[766]: <info> [1721163311.1641] manager: NetworkManager state is now CONNECTED_GLOBAL
Jul 16 20:55:11 noble NetworkManager[766]: <info> [1721163311.1643] manager: startup complete
You can also use nmcli
to see active interfaces managed by NetworkManager.
$ nmcli connection show
NAME UUID TYPE DEVICE
netplan-ens3 bec3d02a-c9e5-3283-92ab-ee43a4246c85 ethernet ens3
lo b82852c2-8ea4-4660-8536-42a4273c0965 loopback lo
In this article we’ve shown you how to switch from systemd-networkd to NetworkManager on an Ubuntu system. If you are stuck our Engineers are available to help out with any issues.
1 thought on “Disable systemd-networkd on Ubuntu Linux”
Did you mean `systemctl disable systemd-networkd.service systemd-networkd.socket`?