Alright Andrew, as promised.
These are steps I took to let networkd manage the Wi-Fi interface on my Pi Zeros. I'll keep this for my own documentation... two birds, one stone.
All steps are described for the interface wlan0
. Note that the filenames and commands are containing wlan0
, this is important.
Initial steps
I would do this in a local session, because the network connection will be disrupted.
First of all, you need to disable your GUI boot.
Then stop and disable your existing network management service. (I don't know which one you are using, probably NetworkManager).
Configure wpa-supplicant for ''wlan0''
Filename: /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
The content is configured as usual, nothing specific to networkd here. Configure as needed.
country=DE
network={
ssid="my-wifi-ssid"
psk="encoded-password"
}
Create the networkd config file for ''wlan0''
Filename: /etc/systemd/network/wlan0.network
An example file, change IP addresses as needed.
[Match]
Name=wlan0
[Network]
Description=Wifi wlan0 static
Address=10.23.45.67/24
Gateway=10.23.45.1
DNS=10.23.45.2
DNS=10.23.45.3
And now the interesting parts to get everything up and running.
Everything needs to be run as root. (you can type sudo -i
to get a root shell)
Stop and disable the default networking scripts
This will disable the default Debian network scripts that use /etc/network/interfaces
. This config will no longer be used.
systemctl stop networking.service
systemctl disable networking.service
Enable and start the wpa_supplicant for ''wlan0''
This starts a wpa_supplicant instance for wlan0 using the config file you created earlier.
systemctl enable wpa_supplicant@wlan0.service
systemctl start wpa_supplicant@wlan0.service
Enable and start the Networkd service
This starts the systemd network service itself.
systemctl enable systemd-networkd.service
systemctl start systemd-networkd.service
Check the results
Should look like this...
root@pizero:~# networkctl
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
2 wlan0 wlan routable configured
Additional resources:
I hope I did not forget anything...