The wikis are now using the new authentication system.
If you did not migrate your account yet, visit https://idp-portal-info.suse.com/

Systemd-networkd

Jump to: navigation, search

Tumbleweed offers network configuration through yast2 lan. Both Wicked and NetworkManager are powerful and flexible. systemd-networkd is a third option:

  1. Configuring without a GUI is more straight forward than configuring NetworkManager.
  2. Being a module of systemd, its memory and CPU usage is extremely low.
  3. systemd-networkd operates fully in the background; no user serviceable parts inside.

Configuration Examples

Minimal Home Network

See: How to Set Up a Home Network- Beginners Guide

The configuration below was tested with Tumbleweed linking to a custom Fritz!Box 7360 supplied by M-net. It incorporates a Wireless access point, Ethernet switch, DSL modem and Router in a single box.

Default name and address are fritz.box / 192.168.178.1. Other routers will use different values. However the sample configuration should work for them with appropriate changes.

Configuration Files

Define the machine's address and hostname by adding a line to /etc/hosts:

erlangen:~ # cat /etc/hosts
#
# hosts         This file describes a number of hostname-to-address
#               mappings for the TCP/IP subsystem.  It is mostly
#               used at boot time, when no name servers are running.
#               On small systems, this file can be used instead of a
#               "named" name server.
# Syntax:
#    
# IP-Address  Full-Qualified-Hostname  Short-Hostname
#

127.0.0.1       localhost

# special IPv6 addresses
::1             localhost ipv6-localhost ipv6-loopback

fe00::0         ipv6-localnet

ff00::0         ipv6-mcastprefix
ff02::1         ipv6-allnodes
ff02::2         ipv6-allrouters
ff02::3         ipv6-allhosts

192.168.178.3   erlangen.fritz.box erlangen
erlangen:~ # 

Make sure systemd-resolved.service is disabled:

erlangen:~ # systemctl status systemd-resolved.service 
● systemd-resolved.service - Network Name Resolution
   Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: man:systemd-resolved.service(8)
           https://www.freedesktop.org/wiki/Software/systemd/resolved
           https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
           https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
erlangen:~ # 


If existing remove any link /etc/resolv.conf and supply file /etc/resolv.conf:

erlangen:~ # cat /etc/resolv.conf
nameserver 192.168.178.1
erlangen:~ # 

Configure the management of the wireless link wlp3s0 by adding a .network file (iwconfig will tell you the name of the link):

erlangen:~ # cat /etc/systemd/network/30-wireless.network
[Match]
Name=wlp3s0

[Network]
Address=192.168.178.3/24
Gateway=192.168.178.1

erlangen:~ #

Configure wpa_supplicant by modifying the existing file wpa_supplicant.conf:

erlangen:~ # cat /etc/wpa_supplicant/wpa_supplicant.conf
network={
    ssid="FRITZ!Box Karl Mistelberger"
    psk="......................."
}
erlangen:~ # 

Systemd Units

Make sure both wicked and NetworkManager are disabled:

erlangen:~ # systemctl list-unit-files 'wick*'
UNIT FILE             STATE   
wicked.service        disabled
wickedd-auto4.service disabled
wickedd-dhcp4.service disabled
wickedd-dhcp6.service disabled
wickedd-nanny.service disabled
wickedd-pppd@.service static  
wickedd.service       indirect

7 unit files listed.
erlangen:~ # systemctl list-unit-files 'Network*'
UNIT FILE                          STATE   
NetworkManager-dispatcher.service  disabled
NetworkManager-wait-online.service disabled
NetworkManager.service             disabled

3 unit files listed.
erlangen:~ # 

Enable systemd-networkd and wpa_supplicant; check settings as follows:

erlangen:~ # systemctl list-unit-files 'systemd-networkd*' 'wpa*'
UNIT FILE                            STATE   
systemd-networkd-wait-online.service enabled 
systemd-networkd.service             enabled 
wpa_supplicant.service               disabled
wpa_supplicant@.service              indirect
systemd-networkd.socket              enabled 

5 unit files listed.
erlangen:~ # 

Note the service for interface wlp3s0:

erlangen:~ # systemctl status wpa_supplicant@wlp3s0.service 
● wpa_supplicant@wlp3s0.service - WPA Supplicant daemon (interface wlp3s0)
   Loaded: loaded (/usr/lib/systemd/system/wpa_supplicant@.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2019-03-29 19:28:49 CET; 16h ago
 Main PID: 1081 (wpa_supplicant)
    Tasks: 1 (limit: 4915)
   Memory: 3.7M
   CGroup: /system.slice/system-wpa_supplicant.slice/wpa_supplicant@wlp3s0.service
           └─1081 /usr/sbin/wpa_supplicant -iwlp3s0 -c /etc/wpa_supplicant/wpa_supplicant.conf -u -t -f /var/log/wpa_supplicant.log

Mar 29 19:28:49 erlangen systemd[1]: Starting WPA Supplicant daemon (interface wlp3s0)...
Mar 29 19:28:49 erlangen systemd[1]: Started WPA Supplicant daemon (interface wlp3s0).
erlangen:~ # 

Verify

Upon rebooting systemd-networkd will be running:

erlangen:~ # journalctl -b -u systemd-networkd -o short-monotonic 
-- Logs begin at Mon 2019-03-18 17:54:36 CET, end at Wed 2019-03-27 12:53:16 CET. --
[    3.524507] erlangen systemd[1]: Starting Network Service...
[    3.567653] erlangen systemd-networkd[519]: Enumeration completed
[    3.569489] erlangen systemd[1]: Started Network Service.
[    3.971240] erlangen systemd-networkd[519]: wlan0: Interface name change detected, wlan0 has been renamed to wlp3s0.
[    4.115384] erlangen systemd-networkd[519]: wlp3s0: Could not bring up interface: Invalid argument
[    4.115650] erlangen systemd-networkd[519]: eth0: Interface name change detected, eth0 has been renamed to enp0s31f6.
[    6.161137] erlangen systemd-networkd[519]: wlp3s0: Gained carrier
[    8.175286] erlangen systemd-networkd[519]: wlp3s0: Gained IPv6LL
[    9.999213] erlangen systemd-networkd[519]: wlp3s0: Configured
erlangen:~ # 
erlangen:~ # networkctl 
IDX LINK             TYPE               OPERATIONAL SETUP     
  1 lo               loopback           carrier     unmanaged 
  2 wlp3s0           wlan               routable    configured
  3 enp0s31f6        ether              off         unmanaged 

3 links listed.
erlangen:~ # 

Disabling IPv6

Older routers, such as the THOMSON TG585 v7 don't support IPv6. Systemd-networkd will try to connect until timeout. Supress IPv6 on a link basis:

linx-paks:~ # cat /etc/systemd/network/ethernet.network 
[Match]
Name=eth0

[Network]

LinkLocalAddressing=no
IPv6AcceptRA=no

Address=10.0.0.1/24
Gateway=10.0.0.138
linus-paks:~ # 

Configure DHCP

Enable resolver:

3400G:~ # systemctl enable --now systemd-resolved.service 
Created symlink /etc/systemd/system/dbus-org.freedesktop.resolve1.service → /usr/lib/systemd/system/systemd-resolved.service.
Created symlink /etc/systemd/system/multi-user.target.wants/systemd-resolved.service → /usr/lib/systemd/system/systemd-resolved.service.
3400G:~ # 


Configuration Files

Replace /etc/resolv.conf by the following link:

3400G:~ # ll /etc/resolv.conf
lrwxrwxrwx 1 root root 32 Oct 27 21:06 /etc/resolv.conf -> /run/systemd/resolve/resolv.conf
3400G:~ # 

Link configuration:

3400G:~ # cat /etc/systemd/network/ethernet.network
[Match]
Name=eno1

[Network]
DHCP=yes
3400G:~ #  

Verify

Upon rebooting systemd-networkd and systemd-resolved will be running:

3400G:~ # journalctl -b -u systemd-resolved.service -o short-monotonic --no-pager 
-- Logs begin at Wed 2020-10-21 16:58:25 CEST, end at Tue 2020-10-27 21:44:16 CET. --
[    4.244461] 3400G systemd[1]: Starting Network Name Resolution...
[    4.328780] 3400G systemd-resolved[592]: Positive Trust Anchors:
[    4.342493] 3400G systemd-resolved[592]: . IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d
[    4.342540] 3400G systemd-resolved[592]: Negative trust anchors: 10.in-addr.arpa 16.172.in-addr.arpa 17.172.in-addr.arpa 18.172.in-addr.arpa 19.172.in-addr.arpa 20.172.in-addr.arpa 21.172.in-addr.arpa 22.172.in-addr.arpa 23.172.in-addr.arpa 24.172.in-addr.arpa 25.172.in-addr.arpa 26.172.in-addr.arpa 27.172.in-addr.arpa 28.172.in-addr.arpa 29.172.in-addr.arpa 30.172.in-addr.arpa 31.172.in-addr.arpa 168.192.in-addr.arpa d.f.ip6.arpa corp home internal intranet lan local private test
[    4.445891] 3400G systemd-resolved[592]: Using system hostname '3400G'.
[    4.447195] 3400G systemd[1]: Started Network Name Resolution.
3400G:~ # 
3400G:~ # journalctl -b -u systemd-networkd.service -o short-monotonic 
-- Logs begin at Wed 2020-10-21 16:58:25 CEST, end at Tue 2020-10-27 21:44:16 CET. --
[    4.181538] 3400G systemd[1]: Starting Network Service...
[    4.233226] 3400G systemd-networkd[535]: Enumeration completed
[    4.244321] 3400G systemd[1]: Started Network Service.
[    4.544194] 3400G systemd-networkd[535]: eth0: Interface name change detected, eth0 has been renamed to eno1.
[    4.589840] 3400G systemd-networkd[535]: eno1: IPv6 successfully enabled
[    4.840393] 3400G systemd-networkd[535]: eno1: Link UP
[    7.784685] 3400G systemd-networkd[535]: eno1: Gained carrier
[    9.216315] 3400G systemd-networkd[535]: eno1: Gained IPv6LL
[   10.753418] 3400G systemd-networkd[535]: eno1: DHCPv4 address 192.168.178.32/24 via 192.168.178.1
3400G:~ #