Iwd: Difference between revisions

From Alpine Linux
m (added link to Wi-Fi entry)
m (→‎Use iwd by itself: Add additional required configuration for this setup and a required soft dependency.)
 
(7 intermediate revisions by 3 users not shown)
Line 14: Line 14:
* support for multiple clients
* support for multiple clients


{{Pkg|iwd|arch=}} is supported since [https://alpinelinux.org/posts/Alpine-3.10.0-released.html Alpine Linux 3.10].


== Installation ==
== Installation and setup ==


Install <code>iwd</code>:
To install <code>iwd</code>:


{{Cmd|# apk add {{Pkg|iwd}}}}
{{Cmd|# apk add {{Pkg|iwd}}}}


To start <code>iwd</code>:
{{cmd|# rc-service iwd start}}


== Usage (iwctl) ==
To have iwd start automatically on every boot (recommended):
{{cmd|# rc-update add iwd default}}
 
{{Note|iwd requires {{pkg|dbus|arch=}} to be running.}}
 
Next you will want to decide if you want to use iwd by itself, with NetworkManager, or with ifupdown-ng:
 
=== Use iwd by itself ===
To have iwd do most networking configuration on its own upon connecting to a wi-fi network, edit the configuration file {{path|/etc/iwd/main.conf}} and set the {{ic|EnableNetworkConfiguration}} directive in the {{ic|[General]}} section to {{ic|True}} and the {{ic|NameResolvingService}} directive in the {{ic|[Network]}} section to {{ic|resolvconf}}. This requires {{pkg|openresolv|arch=}}. For example:
 
{{cat|/etc/iwd/main.conf|[General]
EnableNetworkConfiguration{{=}}True
 
[Network]
NameResolvingService{{=}}resolvconf}}
 
=== Use iwd as a networkmanager Backend ===
{{main|NetworkManager#iwd backend}}
iwd can be used as a replacement for the wpa_supplicant backend in NetworkManager. See [[NetworkManager#iwd_backend|the relevant NetworkManager section]] for more information.
 
=== Use iwd with ifupdown-ng ===
iwd can delegate the responsibility dealing with IP address assignment (either static or DHCP) to ifupdown-ng. To do this edit the {{path|/etc/network/interfaces}} file. For example, if you are using DHCP on the wlan0 interface:
{{cat|/etc/network/interfaces|auto lo
iface lo inet loopback
 
auto wlan0
iface wlan0 inet dhcp}}
 
== Usage of iwctl command ==


The iwd package provides the client program <code>iwctl</code>, the daemon <code>iwd</code> and the Wi-Fi monitoring tool <code>iwmon</code>.
The iwd package provides the client program <code>iwctl</code>, the daemon <code>iwd</code> and the Wi-Fi monitoring tool <code>iwmon</code>.
Line 64: Line 95:
{{Note|
{{Note|
* iwd automatically stores network passphrases in the {{Path|/var/lib/iwd}} directory and uses them to auto-connect in the future.
* iwd automatically stores network passphrases in the {{Path|/var/lib/iwd}} directory and uses them to auto-connect in the future.
* If you run diskless Alpine, be sure to commit: {{Cmd|# lbu add /var/lib/iwd && lbu commit -d}}
* To connect to a network with spaces in the SSID, the network name should be double quoted when connecting.
* To connect to a network with spaces in the SSID, the network name should be double quoted when connecting.
* iwd only supports PSK pass-phrases from 8 to 63 ASCII-encoded characters. }}
* iwd only supports PSK pass-phrases from 8 to 63 ASCII-encoded characters. }}
Line 100: Line 132:
* channel utilization
* channel utilization
* time since the last connect.}}
* time since the last connect.}}


== Dedicated GUI (iwgtk) ==
== Dedicated GUI (iwgtk) ==
Line 110: Line 141:
{{Cmd|# apk add {{Pkg|iwgtk}}}}
{{Cmd|# apk add {{Pkg|iwgtk}}}}


 
== Troubleshooting ==
== Usage as a Backend ==
If {{ic|iwctl}} commands fail with the message {{ic|The name net.connman.iwd was not provided by any .service files  Failed to retrieve IWD dbus objects, quitting...}}, this means that the {{ic|iwd}} daemon is not started.
 
iwd can be used as a replacement backend for NetworkManager. See [[NetworkManager#iwd_backend|the relevant NetworkManager section]] for more information.
 


== See also ==
== See also ==

Latest revision as of 09:16, 8 March 2024


iwd (iNet Wireless Daemon) is a wireless daemon for Linux. It is written by Intel and aims to replace wpa_supplicant. The core goal of the project is to optimize resource utilization: storage, runtime memory and link-time costs. This is accomplished by not depending on any external libraries and utilizes features provided by the Linux Kernel to the maximum extent possible. The result is a self-contained environment that only depends on the Linux Kernel and the runtime C library.

Potential benefits of iwd include:

  • simplification of network management
  • faster network discovery
  • fast and reliable roaming
  • using less system resources
  • using features offered by the Linux kernel
  • support for enterprise security methods like EAP
  • support for kernel asymmetric key rings and Trusted Platform Modules (TPM)
  • support for multiple clients

iwd is supported since Alpine Linux 3.10.

Installation and setup

To install iwd:

# apk add iwd

To start iwd:

# rc-service iwd start

To have iwd start automatically on every boot (recommended):

# rc-update add iwd default

Note: iwd requires dbus to be running.

Next you will want to decide if you want to use iwd by itself, with NetworkManager, or with ifupdown-ng:

Use iwd by itself

To have iwd do most networking configuration on its own upon connecting to a wi-fi network, edit the configuration file /etc/iwd/main.conf and set the EnableNetworkConfiguration directive in the [General] section to True and the NameResolvingService directive in the [Network] section to resolvconf. This requires openresolv. For example:

Contents of /etc/iwd/main.conf

[General] EnableNetworkConfiguration=True [Network] NameResolvingService=resolvconf

Use iwd as a networkmanager Backend

iwd can be used as a replacement for the wpa_supplicant backend in NetworkManager. See the relevant NetworkManager section for more information.

Use iwd with ifupdown-ng

iwd can delegate the responsibility dealing with IP address assignment (either static or DHCP) to ifupdown-ng. To do this edit the /etc/network/interfaces file. For example, if you are using DHCP on the wlan0 interface:

Contents of /etc/network/interfaces

auto lo iface lo inet loopback auto wlan0 iface wlan0 inet dhcp

Usage of iwctl command

The iwd package provides the client program iwctl, the daemon iwd and the Wi-Fi monitoring tool iwmon.

Begin by starting the client:

$ iwctl

To list all available commands:

[iwd]# help

Connect to a network

First, if you do not know your wireless device name, list all Wi-Fi devices:

[iwd]# device list

If the device or its corresponding adapter is turned off, turn it on:

[iwd]# device device set-property Powered on
[iwd]# adapter adapter set-property Powered on

Then, to initiate a scan for networks (note that this command will not output anything):

[iwd]# station device scan

You can then list all available networks:

[iwd]# station device get-networks

Finally, to connect to a network:

[iwd]# station device connect SSID

If a passphrase is required, you will be prompted to enter it. Alternatively, you can supply it as a command line argument:

$ iwctl –passphrase passphrase station device connect SSID

Note:
  • iwd automatically stores network passphrases in the /var/lib/iwd directory and uses them to auto-connect in the future.
  • If you run diskless Alpine, be sure to commit:

    # lbu add /var/lib/iwd && lbu commit -d

  • To connect to a network with spaces in the SSID, the network name should be double quoted when connecting.
  • iwd only supports PSK pass-phrases from 8 to 63 ASCII-encoded characters.

Disconnect from a network

To disconnect from a network:

[iwd]# station device disconnect

Show device and connection information

To display the details of a WiFi device, like MAC address:

[iwd]# device device show

To display the connection state, including the connected network of a Wi-Fi device:

[iwd]# station device show

Manage known networks

To list networks you have connected to previously:

[iwd]# known-networks list

To forget a known network:

[iwd]# known-networks SSID forget
Note: It is not possible to assign a priority to a network, instead iwd will prioritize networks based on:
  • signal strength level
  • security features
  • maximum rate
  • channel utilization
  • time since the last connect.

Dedicated GUI (iwgtk)

iwgtk showing list of networks
iwgtk

iwgtk is a wireless networking GUI for Linux with supported functionality similar to that of iwctl. Features include viewing and connecting to available networks, managing known networks, provisioning new networks via WPS or Wi-Fi Easy Connect, and an indicator (tray) icon displaying connection status and signal strength.

# apk add iwgtk

Troubleshooting

If iwctl commands fail with the message The name net.connman.iwd was not provided by any .service files Failed to retrieve IWD dbus objects, quitting..., this means that the iwd daemon is not started.

See also