For administrators running minimal Linux environments or servers without a GUI, using a heavy networking manager like NetworkManager or netplan may be unnecessary. Enter systemd-networkd — a lightweight, native option for managing network configurations efficiently.
In this blog, we’ll walk you through how to set up networking using systemd-networkd, whether you need a static IP or DHCP.
1. Identify Your Network Interface
Before configuring the network, determine the name of your interface:
ip link
You’ll see output like eth0, ens3, or enp1s0. Note down the correct interface name, as you’ll use it in configuration files.
2. Disable Other Network Managers
To prevent conflicts, disable any existing network management services like NetworkManager:
sudo systemctl disable NetworkManager
sudo systemctl stop NetworkManager
If you’re using netplan (common in Ubuntu), make sure it’s disabled or removed as well.
3. Enable systemd-networkd
Now enable and start the systemd-networkd service:
sudo systemctl enable systemd-networkd
sudo systemctl start systemd-networkd
4. Create a Network Configuration File
Next, you’ll create a .network configuration file in /etc/systemd/network/. Use a descriptive name, like 10-wired.network.
For Static IP Configuration:
[Match]
Name=eth0
[Network]
Address=192.168.1.100/24
Gateway=192.168.1.1
DNS=8.8.8.8
For DHCP Configuration:
[Match]
Name=eth0
[Network]
DHCP=yes
Replace eth0 with your actual interface name and update IP/gateway as needed.
5. Set Up DNS with systemd-resolved
Enable DNS management via systemd-resolved:
sudo systemctl enable systemd-resolved
sudo systemctl start systemd-resolved
Then create a symbolic link for the resolver:
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
6. Restart and Verify
Apply the new configuration:
sudo systemctl restart systemd-networkd
Verify with:
networkctl status
ip a
If configured properly, you’ll see your interface active with the assigned IP address.
Conclusion
Whether you’re setting up a lab environment, a VPS, or a production Linux server without a GUI, systemd-networkd is a clean and reliable solution for managing network configurations. Its lightweight design and systemd integration make it ideal for modern Linux systems.
Setting up a fresh server or building out your dev environment? Don’t miss our internal guide on How to Install Apache Maven on Windows and Linux — a must-read for anyone managing build tools in hybrid environments.
ServerAdminz provides 24/7 Linux server management and network configuration support. Reach out to us today for expert assistance with server setup, recovery, and optimization.