Debian/Ubuntu and RHEL/AlmaLinux have different network configuration utilities. RHEL 9 has deprecated ifcfg-files, and adopted NetworkManager. There is no ifup
or ifdown
any more after a fresh installation. Since my server was first installed using Ubuntu 14.04, it still uses these scripts. Time to move on.
1. ifupdown
Netplan is used to configure networking in Ubuntu 18.04 and later. Ubuntu Server is packaged with systemd-networkd as the backend for Netplan, while NetworkManager is used as the Netplan backend in Ubuntu Desktop. Install by:
Get current network status by:
eth0
is unmanaged, since ifupdown
is used. The config file is /etc/network/interfaces
.
2. networkd
Create a config file /etc/netplan/50-cloud-init.yaml
This file is create by cloud-init if fresh installed. I kept the name. networkd
comes with systemd
, no need to install it again. Apply it by:
Now, eth0
should be managed by networkd
:
The generated config file can be found in /run/systemd/network/10-netplan-eth0.network
. System config files located in /etc/systemd/networkd.conf
& /usr/lib/systemd/network/
.
3. NetworkManager
NetworkManager
can also be used for servers. Install by:
Create a config file /etc/netplan/01-network-manager-all.yaml
.
This file is create by Ubuntu installer if fresh installed. I kept the name. Verify the merged config by running:
NOTE, one additional step need to be performed, /etc/network/interfaces
must *not* exist. NetworkManager
has a plugin to parse the file. Backup it, so that you can roll back to ifupdown
if something goes wrong. Apply it by:
Now, eth0
should be managed by NetworManager
:
The generated config file can be found in /run/NetworkManager/system-connections/netplan-eth0.nmconnection
. System config files located in /etc/NetworkManager/NetworkManager.conf
& /usr/lib/NetworkManager/
. On systems before RHEL 9, /run
may be /var/run
. When NetworkManager
starts and finds no connection for a device it might create an in-memory connection. No config file is created. The no-auto-default
configuration disables that behavior. Check systemd log for details:
More info can be found in Debian documents. Useful commands include: NetworkManager --print-config
, nmcli device
& nmcli connection
.
4. Clean ups
Now, you can safely remove ifupdown
, and the networking
systemd service will be removed too.
5. iptables
An ifupdown
script was add to persist iptables
rules.
This can be migrated by installing iptables-persistent
: