Skip to content

Instantly share code, notes, and snippets.

@eikenb
Created July 30, 2019 19:50
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eikenb/1e9faeb8210e639e8caa69e9832db594 to your computer and use it in GitHub Desktop.
Save eikenb/1e9faeb8210e639e8caa69e9832db594 to your computer and use it in GitHub Desktop.
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