systemd-networkd - Arch - Ubuntu - RHEL
A systemd network tool:
networkctl
Disable Network Manager and enable systemd-networkd.
sudo systemctl disable NetworkManager
sudo systemctl enable systemd-networkd
This network configuration directory will need to exist. Create it:
sudo mkdir /etc/systemd/network
Any NIC that matches this pattern will be configured to use DHCP:
sudo vi /etc/systemd/network/20-wired.network[Match] Name=enp3* [Network] DHCP=yes
This specific NIC will be configured with the static IP specified:
sudo vi /etc/systemd/network/10-wired.network[Match] Name=enp3s0 [Network] Address=192.168.3.25/24 Gateway=192.168.3.1 DNS=8.8.8.8
You can restart systemd-networkd after making any changes.
sudo systemctl restart systemd-networkd
Bridged Interfaces
Here is an example of creating a device for a bridge interface:
sudo vi /etc/systemd/network/bridge-br0.netdev[NetDev] Name=br0 Kind=bridge
This would add a NIC to a bridged interface:
sudo vi /etc/systemd/network/bridge-br0-slave.network[Match] Name=eth1 [Network] Bridge=br0
This would define the static IP info for a bridged interface:
sudo vi /etc/systemd/network/bridge-br0.network[Match] Name=br0 [Network] Address=192.168.3.25/24 Gateway=192.168.3.1 DNS=8.8.8.8
Wifi
A wireless interface might be configured like this:
/etc/systemd/network/25-wireless.network[Match] Name=wlp2s0 [Network] DHCP=yes IgnoreCarrierLoss=3s
More Info
systemd-networkd-wait-online |
Set a priority if you have more than one interface:
[DHCPv4]
RouteMetric=20
[IPv6AcceptRA]
RouteMetric=20