Systemd Networking

I've recently stopped using NetworkManger to manage my network and VPN connections as it seems to be a bit fiddly to get working with WireGuard.

Make sure all NetworkManager things have been removed.

Install systemd-resolvconf if you intend to use WireGuards wg-quick tool.

sudo pacman -S systemd-resolvconf

Then enable systemd-resolved and systemd-networkd.

sudo systemctl enable systemd-resolved
sudo systemctl enable systemd-networkd

Next remove the file (or symlink) at /etc/resolv.conf and replace it with a new link to the systemd-resolvd version.

sudo rm -f /etc/resolv.conf

# or move it...
# sudo mv /etc/resolv.conf /etc/resolv.conf.bak

sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf

For pihole users it may be useful to disable any fallback DNS settings. Do this by creating a file/etc/systemd/resolved.conf.d/fallback_dns.conf.

sudo mkdir -p /etc/systemd/resolved.conf.d
sudo vim /etc/systemd/resolved.conf.d/fallback_dns.conf

With this content:

[Resolve]
FallbackDNS=

Network adapters

I disable Predictable Network Interface Names because I find it annoying to not know what my devices are called. These adapters don't change often (if ever) and I'd like the names to be the OG eth0 or wlan0 name. To do this, add net.ifnames=0 to the kernel options in /boot/loader/entries/entry.conf.

Wired

Create a file in /etc/systemd/network/20-wired.network with the contents:

[Match]
Name=eth0

[Network]
DHCP=yes

Wireless

Install the iwd package and create a file in /etc/iwd/main.conf with the content:

[General]
EnableNetworkConfiguration=true

[Network]
NameResolvingService=systemd

Enable/start the service with sudo systemctl enable --now iwd.service.

This service messes about a little bit with devices so a reboot may be necessary here.

Finally configure the WiFi adapter with iwctl.

References


Content properties

  • Type: Note
  • Category: Linux
  • Tags: ops, linux
  • Custom slug: None

This is a preview of a simpler page design that I'm working on over the next little bit. I've finally added a (click it!) but there's still a few pages left to be converted so don't worry if things don't look quite right just yet 🙏

Content on blog pages use the CC-BY-SA license. The source code and notes use the MIT license. Unsure? Mention me on Mastodon.