Systemd-networkd

Wechseln zu: Navigation, Suche

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


Configuration examples

Minimal Home Network

Home Networking Basics: How to Set Up a Home Network

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:~ # 

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:~ # 

Make sure systemd-resolved.service is disabled. 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:~ # 

Units

Make sure both wicked and NetworkManager are disabled. Enable systemd-networkd and wpa_supplicant; check settings as follows:

erlangen:~ # systemctl list-unit-files 'wpa*' 'systemd-networkd*' 'wicked*' 'NetworkManager*'
UNIT FILE                            STATE   
NetworkManager-dispatcher.service    disabled
NetworkManager-wait-online.service   disabled
NetworkManager.service               disabled
systemd-networkd-wait-online.service enabled
systemd-networkd.service             enabled
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
wpa_supplicant.service               disabled
wpa_supplicant@.service              indirect
systemd-networkd.socket              enabled 

15 unit files listed.
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:~ #