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

M ↓   Markdown
?
Anonymous
1 point
3 years ago

Much appreciated. And to think there was a time where a standard minimal installation was actually respectful...

?
Anonymous
1 point
3 years ago

This is great, thanks! I want control of my network, thank you very much, systemDenigrater.

?
Anonymous
1 point
4 years ago

Thank you for this, saved me massive headache with proxmox and bridges. You are the man!

S
stefanhart
1 point
4 years ago

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.

?
Anonymous
0 points
19 months ago

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!

?
Anonymous
0 points
3 years ago

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

?
Anonymous
0 points
14 days ago

Thanks for the article, ubuntu becomes acceptable after the removal of complex crap that goes against tradition and ease of use.

?
Anonymous
0 points
13 months ago

Love you