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
Much appreciated. And to think there was a time where a standard minimal installation was actually respectful...
This is great, thanks! I want control of my network, thank you very much, systemDenigrater.
Thank you for this, saved me massive headache with proxmox and bridges. You are the man!
Thank you very much! My search of "get rid of systemd-networkd" pointed me fast to your site. Unfortunately systemdr*ck settles anywhere, and it is not becoming easier to get rid of it and substitute it with something keep it simpler but a little slower.
Thank you very much, I still can't understand how they can leave such a broken setup which absolutely does not work. At least there's some hope with your solution to get out of the 4th dimension!
This is awesome!!! I even expanded on your blog over here.
https: //unix.stackexchange.com/questions/591414/how-do-you-block-network-acceess-to-systemd
Thanks for the article, ubuntu becomes acceptable after the removal of complex crap that goes against tradition and ease of use.
Love you