Managing wired connection with systemd-networkd#

Systemd package supposed to contain all the necessary parts to operate wired network.

Wired network with static IP#

Create a file /etc/systemd/network/20-wired.network with following content:

[Match]
Name=ETH0

[Network]
Address=10.1.1.2/24
Gateway=10.1.1.1
DNS=10.1.1.1

Change Name key for desired adapter, change Address, Gateway and DNS key for desired static IP address, gateway and DNS server.

Wired network using DHCP#

Create a file /etc/systemd/network/20-wired.network with following content:

[Match]
Name=ETH0

[Network]
DHCP=yes

Change Name key for desired adapter.

Configuration files#

The global configuration file in /etc/systemd/networkd.conf may be used to override some defaults. Configuration files are located in /usr/lib/systemd/network/, the volatile runtime network directory /run/systemd/network/ and the local administration network directory /etc/systemd/network/. Files in /etc/systemd/network/ have the highest priority.

Rules are:

  • If all keys in the [Match] section are matched, the profile is activated

  • an empty [Match] section equivalent to * wildcard, profile is active always

  • all configuration files are collectively sorted and processed in lexical order, regardless of the directory in which they live

  • files with identical name replace each other

Meaning of particular keys can be obtained from official systemd-networkd documentation.