The one where I leave it to systemd-networkd

January 31, 2024

I like keeping my Debian 12 installation bare bones. Sometimes bare bones means accidentally disabling your only link to the outside world.

Among other recent cleanup operations, I managed to make my Ethernet interface (enp7s0) not go up automatically anymore after booting my machine. Jogging my memory of what I might have done on the previous day, I recalled trying to purge Gnome-related utilities. Among those was the Gnome NetworkManager, which even without a GUI or Desktop Environment (I don’t use Gnome) will still try to configure network interfaces in the background. As a consequence, my Ethernet interface would not go up automatically anymore.

The idea of needing a Desktop Environment to enjoy the side-effect of having a working network interface is perplexing. I’d rather leave it something that works, independent of a graphical user interface.

But, I got tired of having to run

ip link set enp7s0 up
dhclient enp7s0

every time I start my computer, and I began to investigate what other means of automatically configuring the interface and especially acquiring a DHCP lease exist. Many Linux distributions use Systemd as their PID 1. Since Systemd is an all-embracing kraken, it also happens to manage network interfaces. Since I vaguely remember enabling some systemd units before like so

# Yours truly scoured StackOverflow and blog spam to come up with these
# incantations
sudo systemctl enable --now systemd-networkd.service
sudo systemctl enable --now systemd-networkd-wait-online@enp7s0.service

and still not seeing the desired result of my interface being configured (perhaps I expect too much magic), I set out to actually Read The Damn Manual.

Here’s everything you will ever want to know about networkd in systemd, courtesy of

The important bits for me were:

  1. I had to see what networkd sees in my system right now, then
  2. tell it to manage the interfaces using a file, and finally
  3. reload and apply any new configuration.

To query the current state of networkd, I ran networkctl list and saw the following:

  1 lo     loopback carrier     unmanaged
  2 enp7s0 ether    routable    unmanaged

The interface connected to my network is enp7s0, and it is not managed by networkd (unmanaged) and instead brought up manually by me using ip link set enp7s0 up and dhclient enp7s0. Networkd acknowledges the presence of the interface, but hasn’t been barked at by a config file to manage it for me, yet. The networkctl manual tells us about the meaning of unmanaged:

unmanaged systemd-networkd is not handling the link.

Let’s fix that, and you will see it’s simple. (but not easy, it only presents itself once you know about all the moving parts)

To tell systemd-network to manage an interface, I created the file in /etc/systemd/network, and copied the following contents from /usr/lib/systemd/network/

# /etc/systemd/network/
# SPDX-License-Identifier: MIT-0
# This example config file is installed as part of systemd.
# It may be freely copied and edited (following the MIT No Attribution license).

# Enable DHCPv4 and DHCPv6 on all ethernet links
# If we want to be really fancy we could match for enp7s0 like so


After which, I just had to run networkctl reload. I query the status again using networkctl list and get the desired result:

  1 lo     loopback carrier     unmanaged
  2 enp7s0 ether    routable    configured

2 links listed.

Finally, running networkctl status shows us the following:

‚óŹ        State: routable
  Online state: online
       Address: on enp7s0
                fe80::dabb:c1ff:fed0:357c on enp7s0
       Gateway: on enp7s0

Beautiful. And that’s it! Let’s see if it holds up after a reboot.

I would be thrilled to hear from you! Please share your thoughts and ideas with me via email.

Back to Index