A little more than a year ago, I followed @Ingo's guides [1] and [2] to switch my RPi Zero W Buster to systemd-networkd and then add an AP in the repeater mode (not bridge).
Now, I'm trying to do the same on a brand new RPi Zero 2W running on Bullseye (lite, 32-bit). 1st part to use systemd-networkd is ok and working fine. Following the 2nd guide (like I did months ago on Buster) creates no error but at the end:
- the access point is there
- client can connect to it
- but the AP interface doesn't get an IPv4 address, doesn't serve DHCP to the clients and IPv6 is back
Starting point : working systemd-networkd on wlan0
File: /etc/wap_supplicant/wpa_supplicant-wlan0.conf
country=fr
update_config=1
ctrl_interface=DIR=/run/wpa_supplicant GRUOP=netdev
p2p_disabled=1
network={
scan_ssid=1
ssid="MYWLANSSID"
psk="MYWLANPASSWORD"
key_mgmt=WPA-PSK
}
File: /etc/systemd/network/08-wifi.network
[Match]
Name=wl*
[Network]
LLMNR=no
LinkLocalAddressing=no
MulticastDNS=no
DNS=1.1.1.1 208.67.222.222 208.67.220.220
Option: using DHCP
DHCP=ipv4
Option: using static address
#Address=192.168.168.240/24
#Gateway=192.168.168.254
[DHCP]
UseDNS=no
Result for: ip 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: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether e4:5f:01:76:65:e9 brd ff:ff:ff:ff:ff:ff
inet 192.168.168.240/24 brd 192.168.168.255 scope global dynamic wlan0
valid_lft 42979sec preferred_lft 42979sec
I also added the DNSSEC=no
line to /etc/systemd/resolved.conf
to workaround the "DNSSEC verification failed" problem that I encountered last year with my PiZero/Buster.
At this stage, everything works fine. IP addresses are only V4 as expected due to LinkLocalAddressing=no
2nd step, adding hostapd, accesspoint@.service as per guide [2]
File: /etc/hostapd/hostapd.conf
driver=nl80211
ssid=MYAPSSID
country_code=FR
hw_mode=g
channel=1
auth_algs=1
wpa=2
wpa_passphrase=MYAPPASSWORD
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
File: accesspoint@.service: exactly as per the guide
Override on wpa_supplicant@wlan0.service: exactly as per the guide
File: /etc/systemd/network/12-ap.network
[Match]
Name=ap@*
[Network]
LLMNR=no
MulticastDNS=yes
LinkLocalAddressing=no
IPMasquerade=yes
Address=192.168.107.1/24
DHCPServer=yes
[DHCPServer]
DNS=192.168.107.1
After reboot
Result from ip 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: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether e4:5f:01:76:65:e9 brd ff:ff:ff:ff:ff:ff
inet6 2a01:e0a:27e:6f60:e65f:1ff:fe76:65e9/64 scope global dynamic mngtmpaddr
valid_lft 86362sec preferred_lft 86362sec
inet6 fe80::e65f:1ff:fe76:65e9/64 scope link
valid_lft forever preferred_lft forever
3: ap@wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether e4:5f:01:76:65:e9 brd ff:ff:ff:ff:ff:ff
inet6 fe80::e65f:1ff:fe76:65e9/64 scope link
valid_lft forever preferred_lft forever
- Wifi client interface wlan0 has lost IPv4 and get 2 IPv6 address.
- AP interface ap@wlan0 doesn't get its static IPv4 address and get an IPv6 instead
- AP is present and device can connect but doesn't get a DHCP IPv4 address
systemctl status accesspoint@wlan0.service (result cut on the right due to serial terminal)
● accesspoint@wlan0.service - accesspoint with hostapd (interface-specific version)
Loaded: loaded (/etc/systemd/system/accesspoint@.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2022-02-13 17:48:30 CET; 4min 55s ago
Process: 319 ExecStartPre=/sbin/iw dev wlan0 interface add ap@wlan0 type __ap (code=exited, status=0/SUCCESS)
Main PID: 357 (hostapd)
Tasks: 1 (limit: 523)
CPU: 144ms
CGroup: /system.slice/system-accesspoint.slice/accesspoint@wlan0.service
└─357 /usr/sbin/hostapd -i ap@wlan0 /etc/hostapd/hostapd.conf
Feb 13 17:48:29 piz2 systemd[1]: Starting accesspoint with hostapd (interface-specific version)...
Feb 13 17:48:30 piz2 systemd[1]: Started accesspoint with hostapd (interface-specific version).
Feb 13 17:48:30 piz2 hostapd[357]: Configuration file: /etc/hostapd/hostapd.conf
Feb 13 17:48:30 piz2 hostapd[357]: ap@wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
Feb 13 17:48:30 piz2 hostapd[357]: Using interface ap@wlan0 with hwaddr e4:5f:01:76:65:e9 and ssid "MYAPSSID"
Feb 13 17:48:30 piz2 hostapd[357]: ap@wlan0: interface state COUNTRY_UPDATE->ENABLED
Feb 13 17:48:30 piz2 hostapd[357]: ap@wlan0: AP-ENABLED
systemctl status wpa_supplicant@wlan0.service
● wpa_supplicant@wlan0.service - WPA supplicant daemon (interface-specific version)
Loaded: loaded (/lib/systemd/system/wpa_supplicant@.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/wpa_supplicant@wlan0.service.d
└─override.conf
Active: active (running) since Sun 2022-02-13 17:48:30 CET; 8min ago
Main PID: 359 (wpa_supplicant)
Tasks: 1 (limit: 523)
CPU: 157ms
CGroup: /system.slice/system-wpa_supplicant.slice/wpa_supplicant@wlan0.service
└─359 /sbin/wpa_supplicant -c/etc/wpa_supplicant/wlan0.conf -Dnl80211,wext -iwlan0
Feb 13 17:48:30 piz2 systemd[1]: Started WPA supplicant daemon (interface-specific version).
Feb 13 17:48:30 piz2 wpa_supplicant[359]: Successfully initialized wpa_supplicant
Feb 13 17:48:30 piz2 wpa_supplicant[359]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=FR
Feb 13 17:48:31 piz2 wpa_supplicant[359]: wlan0: Trying to associate with SSID 'MYWLANSSID'
Feb 13 17:48:32 piz2 wpa_supplicant[359]: wlan0: Associated with 88:c3:97:f2:25:ec
Feb 13 17:48:32 piz2 wpa_supplicant[359]: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Feb 13 17:48:32 piz2 wpa_supplicant[359]: wlan0: WPA: Key negotiation completed with 88:c3:97:f2:25:ec [PTK=CCMP GTK=TKIP]
Feb 13 17:48:32 piz2 wpa_supplicant[359]: wlan0: CTRL-EVENT-CONNECTED - Connection to 88:c3:97:f2:25:ec completed [id=0 id_str=]
Feb 13 17:48:32 piz2 wpa_supplicant[359]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=CN
systemctl status hostapd.service
● hostapd.service
Loaded: masked (Reason: Unit hostapd.service is masked.)
Active: inactive (dead)
As of now, my conclusion is that systemd-networkd doesn't seem to read correctly the 08-wifi.network
and 12-ap.network
files
But I have no idea why.
The same is running find on a RPiZeroW with Buster
TIA for your advices and suggestions
[1] Use systemd-networkd for general networking
[2] Access point as WiFi router/repeater, optional with bridge