Arch Linux - How to Install systemd Network Manager

Arch Linux - How to Install systemd Network Manager

The package systemd is part of the default Arch installation.

systemctl enable systemd-networkd.service
Created symlink /etc/systemd/system/dbus-org.freedesktop.network1.service → /usr/lib/systemd/system/systemd-networkd.service.
Created symlink /etc/systemd/system/multi-user.target.wants/systemd-networkd.service → /usr/lib/systemd/system/systemd-networkd.service.
Created symlink /etc/systemd/system/sockets.target.wants/systemd-networkd.socket → /usr/lib/systemd/system/systemd-networkd.socket.
Created symlink /etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service → /usr/lib/systemd/system/systemd-networkd-wait-online.service.

Let's change the configuration for our wired adapter using a static IP.

[Match]
Name=ens18

[Network]
Address=192.168.45.5/24
Gateway=192.168.45.1
DNS=192.168.45.1
/etc/systemd/network/20-wired.network

Or the below to DHCP.

[Match]
Name=enp1s0

[Network]
DHCP=yes
/etc/systemd/network/20-wired.network

Systemd also has a module for DNS and it will pick the DNS servers set in our /etc/resolv.conf. Let's edit it as seen below :

# Generated by NetworkManager
search localdomain
nameserver 192.168.45.1
/etc/resolv.conf

We need to enable and start the systemd DNS resolver as donethe systemd network manager.

systemctl enable systemd-resolved.service
systemctl start systemd-resolved.service
systemctl start systemd-networkd.service
[root@docker0 ~]# ip -c addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 62:05:a9:cb:94:d1 brd ff:ff:ff:ff:ff:ff
    altname enp0s18
    inet 192.168.45.5/24 brd 192.168.45.255 scope global ens18
       valid_lft forever preferred_lft forever
    inet6 fe80::6005:a9ff:fecb:94d1/64 scope link 
       valid_lft forever preferred_lft forever

Resources

systemd-networkd - ArchWiki
How to Use Arch Linux Network Manager
Arch Linux comes with a utility for network management, it’s called NetworkManager. This tool is responsible for providing automatic detection, configuration, and connection to networks.
How to Use Arch Linux Network Manager
Arch Linux comes with a utility for network management, it’s called NetworkManager. This tool is responsible for providing automatic detection, configuration, and connection to networks.
Network configuration - ArchWiki