Trixie iwd

From Debian Forums Cache
Jump to navigation Jump to search

Had working iwd wifi on Bookworm and systemd-networkd.

Works also in Trixie, but took a few hours to figure out how wifi is up at boot.

The solution was to edit /etc/iwd/main.conf

arto@niuzu:~$ cat /etc/iwd/main.conf

  1. For complete description of supported configuration options, refer to
  2. 'man 5 iwd.config'.

[General]

  1. iwd is capable of performing network configuration on its own, including
  2. DHCPv4 based address configuration. By default this behavior is
  3. disabled, and an external service such as NetworkManager, systemd-network
  4. or dhcpclient is required. Uncomment the following line if you want iwd
  5. to manage network interface configuration.

EnableNetworkConfiguration=true

and setting in the [General] section EnableNetworkConfiguration on by removing # from the front of it.

This article was posted by arzgi: https://forums.debian.net/viewtopic.php?t=163650


Edit by sunrat:

Having just set this myself, some more information is needed. The guide in the Debian Wiki was almost all I needed.

I used the standalone setup, no NetworkManager here. Extra packages were required to be install. As well as iwd it needed dependency of libell0, and firmware for my device which is firmware-atheros. Check you have the correct firmware for your device. I also had to enable resolvconf in /etc/iwd/main.conf as I don't have systemd-resolved running.

[c]NameResolvingService=resolvconf[/c]

The rest is copied from Debian Wiki WiFiHowToUse

IWCtl

While also available as backend for ConnMan, NetworkManager, and systemd-networkd, it's also possible to nearly base your entire networking stack on one codebase with IWD alone. It's an all-in-one wireless client, wireless daemon, and even a DHCP client optionally! At its best, your entire networking stack can be as minimal as IWD + systemd-resolved, and this works wonderfully for many scenarios. It has virtually zero dependencies and uses modern kernel features as often as possible. Anecdotal reports suggest that it's much faster to connect to networks than wpa_supplicant, and has better roaming support, among other perceived improvements.

First, install the iwd package. If you've installed wpasupplicant, either uninstall the package, or stop and disable the wpa_supplicant service with:

systemctl --now disable wpa_supplicant

Then, ensure that the newly-installed IWD service is enabled and running with with:

systemctl --now enable iwd

Network Configuration

If you plan to go the route of using IWD standalone, you should first enable some essential features in IWD's configuration file, which can be found at /etc/iwd/main.conf. Edit this file with root permissions using your favorite editor.

iwd can be configured to configure the network on its own, without requiring external tools or systems to do so. To enable network configuration, add this section to the configuration file:

[General]
EnableNetworkConfiguration=true

Static network configuration can be specified in iwd's network configuration files, as documented in man iwd.network and in the iwd wiki. As per man iwd.config, "If no static IP configuration has been provided for a network, iwd will attempt to obtain the dynamic addresses from the network through the built-in DHCP client."

IPv6

To enable IPv6 support, add this section to the configuration file:

[Network]
EnableIPv6=true

Note: IPv6 is still somewhat broken as of version 1.19.

Enabling IPv6 can cause segmentation faults upon connection. Upstream believes that this has been fixed by commit d0f00698245a ("dhcp6: Switch to BOUND before LEASE_OBTAINED"), but acknowledges that "IPv6 support in iwd is still somewhat experimental since we still lack support for SLAAC," although "DHCPv6 should be mostly functional."

After making changes to iwd's configuration file, restart the service with "service iwd restart" to have them take effect.

Configuring iwd Via iwctl

Start the IWCtl client by running iwctl as your standard user (not root!), which will start an interactive prompt. You can run help to get a full list of commands here. (If you actually want to prevent non-root users from configuring iwd, see the directions here.)

To connect to a Wi-Fi network in the most typical scenario, first type device list to find the name of your wireless device. We will use wlan0 in this example, but your name may be different, and potentially much longer if your system renames interfaces to a unique name.

After you have the device name, run something like station wlan0 scan to have the device scan for networks. You can then list these networks by running station wlan0 get-networks. After you've found the network you intend to connect to, run station wlan0 connect Router123, replacing Router123 with the name of the network. Put the name of the network in double-quotes if it contains a space. (Note that you can use tab completion to enter the network name, and iwd will even help with the quoting.)

IWCtl will then prompt you for the passphrase. After entering this, IWD will connect to the network, and store it permanently in the /var/lib/iwd directory. After being added in this way, IWD will attempt to auto-connect to the network in the future.

Try running ping 1.1.1.1 to see if you can reach an IP, and then ping gnu.org to see if you can reach a domain. If you can't reach an IP, something's gone horribly wrong when connecting to the network. If you can't reach a domain but you can reach an IP, you'll need to configure your DNS. The simplest way to accomplish that is ...

Setting up DNS resolution for IWD (Simple)

If "EnableNetworkConfiguration=true" is set, you'll also need to configure IWD's name resolving service. It supports systemd-resolved and resolvconf. If unspecified, it uses systemd-resolved. Refer to the IWD.CONFIG(5) page if you care about using resolvconf instead.

If DNS is nonfunctional, you likely need to configure systemd-resolved for use with IWD. Enable and start the systemd-resolved service, if it isn't already, by running:

systemctl enable --now systemd-resolved

Then, symlink /etc/resolv.conf to /run/systemd/resolve/stub-resolv.conf by running:

# ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

That should be enough to get you online. If you want to make changes to your DNS configuration, refer to the /etc/systemd/resolved.conf file, and the associated manual page at RESOLVED.CONF(5)


This articles was taken from a post by argzi on the Debian User Forums: https://forums.debian.net/viewtopic.php?p=828389