Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Updated network stack for Buster

For years my network stack has been based around ifupdown and wpa_supplicant but after a recent experience fighting them I decided to look to see what Buster offered and came out with a pretty nice new stack.

Old stack: ifupdown, ifplugd, dhcpcd, wpa_supplicant, resolvconf, unbound

New stack: systemd{-networkd,-resolved} + iwd [+ networkd-dispatcher]

The new setup has systemd-networkd network device setup, networkd-resolvconf handling DNS lookup and caching, networkd-dispatcher dealing with up/down hooks and iwd handling the wifi negotiations. It all works surprisingly well and the setup was very simple. Be sure to stop and disable whatever you are currently using to avoid conflicts.

Install the one missing piece.

$ apt install iwd

Configure ethernet and wifi... (replace and with appropriate names)

$ sudo tee /etc/systemd/network/eth.network > /dev/null << EOF
[Match]
Name=<eth>
[Network]
DHCP=yes
[DHCP]
RouteMetric=10
EOF

$ cat >> /etc/systemd/network/wifi.network << EOF
[Match]
Name=<wifi>
[Network]
DHCP=yes
[DHCP]
RouteMetric=20
EOF

Enable and start up networkd/resolved.

$ systemctl --now enable systemd-networkd.service
$ systemctl --now enable systemd-resolved.service

Sym-link /etc/resolv.conf to resolved's generated one.

$ ln -s /var/run/systemd/resolve/stub-resolv.conf /etc/resolve.conf

Use iwctl to connect to wifi (https://wiki.archlinux.org/index.php/Iwd)

Note these can mostly be run as a standard user

$ iwctl device list
$ sudo rfkill unblock <wifi>  # needed once after boot
$ iwctl station <wifi> scan
$ iwctl station <wifi> get-networks
$ iwctl station <wifi> connect <ssid>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment