systemd-networkd: Declarative Network Configuration on Linux

systemd-networkd is a lightweight network manager that fits servers, VMs, and minimal images well. It uses declarative files and integrates naturally with the rest of the systemd stack.

Table of Contents

This post covers practical networkd setup, matching logic, and troubleshooting.

Core Concepts

Configuration Patterns

Series Navigation

When to use systemd-networkd

networkd is usually a strong fit when:

  • The host is headless and managed by automation
  • You want small footprint and simple text configuration
  • You already use systemd heavily for service lifecycle

On desktop systems, NetworkManager may be a better fit for interactive workflows. Avoid running both managers against the same interface set because ownership conflicts cause unstable behavior.

Enable and inspect networking state

Enable networkd and inspect link state with networkctl.

sudo systemctl enable --now systemd-networkd.service
systemctl status systemd-networkd.service
networkctl list
networkctl status

These commands provide link state, addressing, and operational status in one place.

Understand configuration file types

Main paths:

  • /etc/systemd/network/*.network for per-interface network policy
  • /etc/systemd/network/*.netdev for virtual devices like bridges and VLANs
  • /etc/systemd/network/*.link for link-level attributes and naming policy
  • /usr/lib/systemd/network/ for vendor-provided defaults

Use /etc/systemd/network for local admin-managed configuration.

Configure a DHCP interface

Example DHCP configuration:

# /etc/systemd/network/10-eth0.network
[Match]
Name=eth0

[Network]
DHCP=yes

Match controls where settings apply, so accurate interface matching is critical.

Configure a static interface

Example static configuration:

# /etc/systemd/network/20-lan0.network
[Match]
Name=ens160

[Network]
Address=192.168.50.10/24
Gateway=192.168.50.1
DNS=192.168.50.1

DNS values may be handed to systemd-resolved, which we cover in the next post.

Create virtual devices with netdev

netdev files define virtual interfaces. This example creates a VLAN and assigns network policy.

# /etc/systemd/network/30-vlan10.netdev
[NetDev]
Name=vlan10
Kind=vlan

[VLAN]
Id=10
# /etc/systemd/network/31-vlan10.network
[Match]
Name=vlan10

[Network]
Address=10.10.10.2/24

The same pattern applies for bridges and bonds, with only the Kind and related sections changing.

Boot ordering and wait-online

Some services require network readiness before startup. In these cases, systemd-networkd-wait-online.service can provide stronger startup ordering guarantees.

systemctl status systemd-networkd-wait-online.service

Use wait-online selectively because strict waiting can increase boot time.

Troubleshooting workflow

A simple troubleshooting sequence:

  • Check networkctl status <ifname> for operational state
  • Verify Match rules target the intended interface
  • Review service logs with journalctl -u systemd-networkd -b
  • Renew DHCP when needed with networkctl renew <ifname>

Useful commands:

networkctl status ens160
networkctl renew ens160
journalctl -u systemd-networkd -b -n 100

Series navigation

With interface configuration covered, the next step is DNS behavior through systemd-resolved.

Next in this series

Next, we cover DNS resolution, resolver routing domains, and resolvectl workflows.

systemd-resolved: DNS, Stub Resolver, and resolvectl