December 12, 2018 · linux networking

Taking Back Control from systemd Networking

systemd is a software suite that is common to many Linux distributions. Although useful, systemd is hard to configure and is too bloated. With systemd, the current networking configuration of the computer becomes much less transparent and manageable, and this is not ideal when managing a networked server. This guide therefore describes how to disable some systemd services, specifically for Ubuntu Server 18.04.

Disabling networkd

First, we can revert the networking service to the original Debian /etc/network/interfaces style of configuring the network:

sudo apt-get update
sudo apt-get install ifupdown

Configure your /etc/network/interfaces using the handy Debian guide. Next, we disable the networkd services.

systemctl stop systemd-networkd.socket systemd-networkd \
networkd-dispatcher systemd-networkd-wait-online
systemctl disable systemd-networkd.socket systemd-networkd \
networkd-dispatcher systemd-networkd-wait-online

We can also remove netplan, as it is no longer used.

sudo apt -y purge netplan.io

Disabling resolved

systemd also has a DNS resolver, but we can disable that:

sudo systemctl disable systemd-resolved.service
sudo systemctl stop systemd-resolved

Delete the symlink /etc/resolv.conf, so that we can edit it.

sudo rm /etc/resolv.conf

Create a new resolv.conf file, and input the DNS Server that you would like to use.

sudo nano /etc/resolv.conf

For example, my file contains:

nameserver 172.16.0.100

Note that the /etc/resolv.conf file will not be automatically updated by your DHCP client unless you delete the following file:

sudo rm /etc/dhcp/dhclient-enter-hooks.d/resolved

References:

https://askubuntu.com/questions/1031709/ubuntu-18-04-switch-back-to-etc-network-interfaces
https://askubuntu.com/questions/907246/how-to-disable-systemd-resolved-in-ubuntu

Update November 2019

Here are two more tips for making a server more manageable. Remove openresolv, with sudo apt remove openresolv. Finally, remove the DHCP client altogether, with sudo apt purge dhcpcd5 isc-dhcp-client isc-dhcp-common