This wiki was updated to MediaWiki 1.37. If you notice any issues, please report them to admin[at]

Network Management With Systemd

Jump to: navigation, search


Systemd tools for networkd and resolved are used to configure network services.


FRITZ!Box 7360

This router provides a DHCP and a DNS server: Handbuch FRITZ!Box 7360 (pdf)

Desktop Computer

6700k:~ # inxi -zSMCDG
  Kernel: 5.19.8-1-default arch: x86_64 bits: 64 Console: pty pts/3 Distro: openSUSE Tumbleweed
  Type: Desktop Mobo: ASRock model: Z170 Pro4S serial: <filter> UEFI: American Megatrends
    v: P7.50 date: 01/23/2018
  Info: quad core model: Intel Core i7-6700K bits: 64 type: MT MCP cache: L2: 1024 KiB
  Speed (MHz): avg: 3600 min/max: 800/4200 cores: 1: 4000 2: 4000 3: 4000 4: 800 5: 4000
    6: 4000 7: 4000 8: 4000
  Device-1: Intel HD Graphics 530 driver: i915 v: kernel
  Display: x11 server: v: with: Xwayland v: 22.1.3 driver: X:
    loaded: modesetting unloaded: fbdev,vesa gpu: i915 tty: 238x52 resolution: 1920x1200
  Message: GL data unavailable in console for root.
  Local Storage: total: 698.65 GiB used: 7.72 GiB (1.1%)
  ID-1: /dev/sda vendor: Samsung model: SSD 850 EVO 500GB size: 465.76 GiB
  ID-2: /dev/sdb vendor: Crucial model: CT250MX500SSD1 size: 232.89 GiB
6700k:~ # 


Check Version installed:

6700k:~ # zypper search --installed-only --details systemd-network
Loading repository data...
Reading installed packages...

S  | Name            | Type    | Version   | Arch   | Repository
i+ | systemd-network | package | 251.4-3.1 | x86_64 | Haupt-Repository (OSS)
6700k:~ # 

Disable Network Services

6700k:~ # systemctl disable --now NetworkManager
6700k:~ # systemctl list-unit-files NetworkManager*
UNIT FILE                          STATE    PRESET  
NetworkManager-dispatcher.service  disabled disabled
NetworkManager-wait-online.service disabled disabled
NetworkManager.service             disabled disabled

3 unit files listed.
6700k:~ # 

Disable Changes To DNS Through Netconfig

Yast2 sysconfig may be used. Verify:

6700k:~ # grep NETCONFIG_DNS_POLICY /etc/sysconfig/network/config
6700k:~ # 

Configure Links

Create a file with the following content (name must end with '.network'):

6700k:~ # cat /etc/systemd/network/ 
Name=w* # wireless link

DHCP=yes # replace by domain of local network
6700k:~ # 


Enable Network Service

3400G:~ # systemctl enable --now systemd-networkd 
3400G:~ # 

Query the status of network links

6700k:~ # networkctl 
  1 lo        loopback carrier     unmanaged
  2 enp0s31f6 ether    off         unmanaged
  3 wlp3s0    wlan     routable    configured

3 links listed.
6700k:~ # 

Enable Network Name Resolution

Resolve domain names, IPV4 and IPv6 addresses, DNS resource records, and services; introspect and reconfigure the DNS resolver

Check current setting of /etc/resolve.conf:

erlangen:~ # ll /etc/resolv.conf
lrwxrwxrwx 1 root root 30 Nov 27 07:54 /etc/resolv.conf -> /var/run/netconfig/resolv.conf
erlangen:~ # 

Save path and contents of target file (handy in case of undoing the changes).

Make sure /etc/resolve.conf is managed by resolved:

3400G:~ # ln -sf /run/systemd/resolve/resolv.conf /etc/
3400G:~ # systemctl enable --now systemd-resolved
3400G:~ # 

6700k:~ # cat /etc/resolv.conf 
# This is /run/systemd/resolve/resolv.conf managed by man:systemd-resolved(8).
# Do not edit.
# This file might be symlinked as /etc/resolv.conf. If you're looking at
# /etc/resolv.conf and seeing this text, you have followed the symlink.
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
# Third party programs should typically not access this file directly, but only
# through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a
# different way, replace this symlink by a static file or a different symlink.
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver fd00::a96:d7ff:fee2:d6cf
6700k:~ # 

Query The Status Of Resolver

6700k:~ # resolvectl 
       Protocols: +LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: uplink

Link 2 (enp0s31f6)
Current Scopes: none
     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported

Link 3 (wlp3s0)
Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6
     Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
   DNS Servers: fd00::a96:d7ff:fee2:d6cf
    DNS Domain:
6700k:~ # 

Wpa Supplicant

Wi-Fi Protected Access client and IEEE 802.1X supplicant

Some editing required. Run "systemctl edit --full wpa_supplicant@wlp3s0.service".

6700k:~ # systemctl cat wpa_supplicant@wlp3s0.service 
# /etc/systemd/system/wpa_supplicant@wlp3s0.service
Description=WPA Supplicant daemon (interface %i)
Requires=sys-subsystem-net-devices-%i.device # Changed %I to lowercase %i
After=sys-subsystem-net-devices-%i.device    # Changed %I to lowercase %i

ExecStart=/usr/sbin/wpa_supplicant -i%i -c /etc/wpa_supplicant/wpa_supplicant.conf -u -t -f /var/log/wpa_supplicant.log

6700k:~ # 

Enable the service:

6700k:~ # systemctl enable --now wpa_supplicant@wlp3s0
6700k:~ # systemctl status wpa_supplicant@wlp3s0
● wpa_supplicant@wlp3s0.service - WPA Supplicant daemon (interface wlp3s0)
     Loaded: loaded (/etc/systemd/system/wpa_supplicant@wlp3s0.service; enabled; preset: disabled)
     Active: active (running) since Sun 2022-09-25 12:05:51 CEST; 5min ago
   Main PID: 9026 (wpa_supplicant)
      Tasks: 1 (limit: 4915)
        CPU: 64ms
     CGroup: /system.slice/system-wpa_supplicant.slice/wpa_supplicant@wlp3s0.service
             └─9026 /usr/sbin/wpa_supplicant -iwlp3s0 -c /etc/wpa_supplicant/wpa_supplicant.conf -u -t -f /var/log/wpa_supplicant.log

Sep 25 12:05:51 6700k systemd[1]: Starting WPA Supplicant daemon (interface wlp3s0)...
Sep 25 12:05:51 6700k systemd[1]: Started WPA Supplicant daemon (interface wlp3s0).
Sep 25 12:10:47 6700k systemd[1]: Started WPA Supplicant daemon (interface wlp3s0).
Sep 25 12:11:30 6700k systemd[1]: Started WPA Supplicant daemon (interface wlp3s0).
6700k:~ # 



Resetting both the DHCP and the DNS server helps in clearing leases and cached information


Enable debugging by uncommenting:

3400G:~ # cat /etc/systemd/system/systemd-networkd.service.d/override.conf
3400G:~ # 

Undoing Changes

See: I think I broke my internet