Iwd: Difference between revisions

From Alpine Linux
(Manually merging content from Wi-Fi article.)
(updated instructions for ifupdown-ng configuration)
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:iwd}}
{{DISPLAYTITLE:iwd}}
iNet Wireless Daemon (iwd) project aims to provide a comprehensive Wi-Fi connectivity solution for Linux based devices. iwd provides a self-contained environment that only depends on the Linux Kernel and the runtime C library. iwd is supported since [https://alpinelinux.org/posts/Alpine-3.10.0-released.html v3.10] of Alpine Linux.


iwd ('''i'''Net '''W'''ireless '''D'''aemon) is a wireless daemon for Linux. It is written by Intel and aims to replace <code>wpa_supplicant</code>. 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.
{{Note|Alpine Linux supports both wireless daemons i.e [[Wi-Fi#wpa_supplicant|wpa_supplicant]] and [[iwd]]. Using both wireless daemons i.e [[Wi-Fi#wpa_supplicant|wpa_supplicant]] and [[iwd]] simultaneously lead to conflicts.}}


Potential benefits of iwd include:
== Prerequisites ==


* simplification of network management
* Ensure that you have [[Wi-Fi#Prerequisites|working wireless drivers]]. 
* faster network discovery
* iwd requires [[D-Bus]] service to be running.
* 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 [https://en.wikipedia.org/wiki/Trusted_Platform_Module Trusted Platform Modules (TPM)]
* 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 ==
 
Install {{Pkg|iwd|arch=}} package using the command:{{Cmd|# apk add {{Pkg|iwd}}}}
 
Next decide if you want to use iwd in Standalone mode, or with NetworkManager, or with ifupdown-ng. Choose one among the three options and then proceed to [[#Service configuration|service configuration.]]


== Installation ==
=== Standalone mode ===


To install <code>iwd</code>:
To have iwd do most networking configuration on its own upon connecting to a wi-fi network, requires {{pkg|openresolv|arch=}} package, so install it first:{{Cmd|# apk add {{Pkg|openresolv}}}}
Then edit the configuration file {{path|/etc/iwd/main.conf}} and set it as follows: {{cat|/etc/iwd/main.conf|[General]
EnableNetworkConfiguration{{=}}True


{{Cmd|# apk add {{Pkg|iwd}}}}
[Network]
NameResolvingService{{=}}resolvconf}}


To start <code>iwd</code>:
To test {{Pkg|openresolv}} package, issue the command:{{ic|# resolvconf -u}} to update the nameserver information in {{Path|/etc/resolv.conf}} file.
{{cmd|# rc-service iwd start}}


To have iwd start automatically on every boot (recommended):
=== Use iwd as a networkmanager backend ===
{{cmd|# rc-update add iwd default}}
{{Main|NetworkManager#iwd_backend}}
[[NetworkManager]] can be configured to manage Network configuration for iwd. Since [[Wi-Fi#wpa_supplicant|wpa_supplicant]] is the default backend in NetworkManager, it must be [[NetworkManager#iwd_backend|replaced by iwd]].


{{Note|iwd requires {{pkg|dbus|arch=}} to be running.}}
=== Use iwd with ifupdown-ng ===


== Usage (iwctl) ==
[[ifupdown-ng]] can be used to manage Network configuration for iwd. Refer to [[#ifupdown-ng configuration|ifupdown-ng configuration]] section.


The iwd package provides the client program <code>iwctl</code>, the daemon <code>iwd</code> and the Wi-Fi monitoring tool <code>iwmon</code>.
== Configuration ==


Begin by starting the client:
{{Note|To avoid conflicts, ensure that [[Wi-Fi#Service_configuration|wpa_supplicant]] and related services are stopped before continuing.}}


{{Cmd|$ iwctl}}
Start iwd service first to proceed with the configuration:{{cmd|# rc-service iwd start}}  


To list all available commands:
The {{pkg|iwd}} package provides the client program <code>iwctl</code>, the daemon <code>iwd</code> and the Wi-Fi monitoring tool <code>iwmon</code>.


Begin by starting the client:{{Cmd|$ iwctl}}
To list all available commands:
  <span style="color:green;">[iwd]</span># help
  <span style="color:green;">[iwd]</span># help


=== Connect to a network ===
=== To connect to a network ===


First, if you do not know your wireless device name, list all Wi-Fi devices:
To list all Wi-Fi devices:
<span style="color:green;">[iwd]</span># device list


<span style="color:green;">[iwd]</span># device list
If your wireless adapter is not listed, refer to [[Wi-Fi#Troubleshooting|Wifi troubleshooting]] page.


If the device or its corresponding adapter is turned off, turn it on:
If the device or its corresponding adapter is turned off, turn it on:
  <span style="color:green;">[iwd]</span># device ''device'' set-property Powered on
  <span style="color:green;">[iwd]</span># device ''device'' set-property Powered on


Line 55: Line 59:


Then, to initiate a scan for networks (note that this command will not output anything):
Then, to initiate a scan for networks (note that this command will not output anything):
  <span style="color:green;">[iwd]</span># station ''device'' scan
  <span style="color:green;">[iwd]</span># station ''device'' scan


You can then list all available networks:
You can then list all available networks:
  <span style="color:green;">[iwd]</span># station ''device'' get-networks
  <span style="color:green;">[iwd]</span># station ''device'' get-networks


Finally, to connect to a network:
Finally, to connect to a network:
  <span style="color:green;">[iwd]</span># station ''device'' connect ''SSID''
  <span style="color:green;">[iwd]</span># 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:
If a passphrase is required, you will be prompted to enter it. Alternatively, you can supply it as a command line argument: {{Cmd|$ iwctl –passphrase ''passphrase'' station ''device'' connect ''SSID''}}
 
{{Cmd|$ iwctl –passphrase ''passphrase'' station ''device'' connect ''SSID''}}


{{Note|
{{Note|
Line 75: Line 74:
* 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. }}
==== IPV6 ====
iwd supports IPv6, but it is disabled by default. To enable it, add the following to the configuration file:
{{Cat|/etc/iwd/main.conf|<nowiki>#[Network]
EnableIPv6=true</nowiki>}}


=== Disconnect from a network ===
=== Disconnect from a network ===
Line 117: Line 109:
* time since the last connect.}}
* time since the last connect.}}


== Dedicated GUI (iwgtk) ==
=== ifupdown-ng configuration ===
 
If [[ifupdown-ng]] is used for network configuration management with iwd, edit the {{path|/etc/network/interfaces}} file based on instructions in [[Configure_Networking#Interface configuration|Network configuration]] page.
 
Whenever system wakes up from sleep/suspend, the wireless interface name may change from {{ic|wlan0}} to {{ic|wlan1}}, {{ic|wlan2}} and so on resulting in loss of connectivity when using [[ifupdown-ng]]. To avoid this issue, create and add the following two files. The {{path|/etc/iwd/main.conf}} file should have:{{cat|/etc/iwd/main.conf|<nowiki>[DriverQuirks]
DefaultInterface=wlan0</nowiki>}}
If mac address of {{ic|wlan0}} interface is "50:91:e3:71:83:d2", then file {{Path|/etc/udev/rules.d/70-persistent-net-wlan0.rules}} should be as follows:{{cat|/etc/udev/rules.d/70-persistent-net-wlan0.rules|<nowiki>SUBSYSTEM=="net", ACTION=="add", ATTRS{address}=="50:91:e3:71:83:d2", NAME="wlan0"</nowiki>}}
The command{{ic|cat /sys/class/net/wlan0/address}} shows the mac address of your wireless interface {{ic|wlan0}}.
For the above changes to take immediate effect, reload Udev rules:{{Cmd|<nowiki># udevadm control --reload-rules
# udevadm trigger</nowiki>}}
A reboot is usually necessary for the changes to fully take effect.
 
=== Service configuration ===
 
To start the iwd service immediately issue the command: {{cmd|# rc-service iwd start}}


[[File:Iwgtk screenshot.png|thumb|right|100px|alt=iwgtk showing list of networks|iwgtk]]
Once iwd service has been fully configured and [[Configure_Networking#Connectivity_testing|tested]], to have iwd service start automatically on every boot (recommended):{{cmd|# rc-update add iwd boot}}


iwgtk is a wireless networking GUI for Linux with supported functionality similar to that of <code>iwctl</code>. 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.
To avoid conflicts, ensure that <Code>wpa_supplicant</Code> service and <Code>networkmanager</Code> (if not used with iwd) are not started automatically.


{{Cmd|# apk add {{Pkg|iwgtk}}}}
Refer to [[openRC]] page for more options.


== iwgtk ==


== Usage as a Backend ==
[[File:Iwgtk screenshot.png|thumb|right|100px|alt=iwgtk showing list of networks|iwgtk]]


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.
[https://github.com/J-Lentz/iwgtk iwgtk] is a wireless networking GUI for iwd with supported functionality similar to that of <code>iwctl</code>. 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.
To install the {{Pkg|iwgtk}} package: {{Cmd|# apk add {{Pkg|iwgtk}}}}


== Troubleshooting ==
== Troubleshooting ==
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.
 
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...}}.
 
The above error means that the {{ic|iwd}} daemon is not started. Start the [[#Service configuration|iwd daemon]]


== See also ==
== See also ==
 
* [[Configure Networking|Main Networking page]]
* [[Wi-Fi]]
* [[Wi-Fi|wpa_supplicant]]
* [[NetworkManager]]
* [https://archive.kernel.org/oldwiki/iwd.wiki.kernel.org/start.html iwd Wiki]
* [https://wiki.gentoo.org/wiki/Iwd iwd on Gentoo Wiki]
* [https://wiki.gentoo.org/wiki/Iwd iwd on Gentoo Wiki]
* [https://wiki.archlinux.org/title/Iwd iwd on ArchWiki]
* [https://wiki.archlinux.org/title/Iwd iwd on ArchWiki]
* [https://iwd.wiki.kernel.org/start iwd Wiki]
* [https://web.git.kernel.org/pub/scm/network/wireless/iwd.git/tree/src/iwd.config.rst  iwd.config file]
* [https://github.com/J-Lentz/iwgtk iwgtk: Lightweight wireless networking GUI (front-end for iwd)]
* [https://github.com/J-Lentz/iwgtk iwgtk: Front-end for iwd]
 


[[Category:Networking]]
[[Category:Networking]]

Revision as of 08:22, 22 March 2025

iNet Wireless Daemon (iwd) project aims to provide a comprehensive Wi-Fi connectivity solution for Linux based devices. iwd provides a self-contained environment that only depends on the Linux Kernel and the runtime C library. iwd is supported since v3.10 of Alpine Linux.

Note: Alpine Linux supports both wireless daemons i.e wpa_supplicant and iwd. Using both wireless daemons i.e wpa_supplicant and iwd simultaneously lead to conflicts.

Prerequisites

Installation

Install iwd package using the command:

# apk add iwd

Next decide if you want to use iwd in Standalone mode, or with NetworkManager, or with ifupdown-ng. Choose one among the three options and then proceed to service configuration.

Standalone mode

To have iwd do most networking configuration on its own upon connecting to a wi-fi network, requires openresolv package, so install it first:

# apk add openresolv

Then edit the configuration file /etc/iwd/main.conf and set it as follows:

Contents of /etc/iwd/main.conf

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

To test openresolv package, issue the command:# resolvconf -u to update the nameserver information in /etc/resolv.conf file.

Use iwd as a networkmanager backend

NetworkManager can be configured to manage Network configuration for iwd. Since wpa_supplicant is the default backend in NetworkManager, it must be replaced by iwd.

Use iwd with ifupdown-ng

ifupdown-ng can be used to manage Network configuration for iwd. Refer to ifupdown-ng configuration section.

Configuration

Note: To avoid conflicts, ensure that wpa_supplicant and related services are stopped before continuing.

Start iwd service first to proceed with the configuration:

# rc-service iwd start

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

To connect to a network

To list all Wi-Fi devices:

[iwd]# device list

If your wireless adapter is not listed, refer to Wifi troubleshooting page.

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.

ifupdown-ng configuration

If ifupdown-ng is used for network configuration management with iwd, edit the /etc/network/interfaces file based on instructions in Network configuration page.

Whenever system wakes up from sleep/suspend, the wireless interface name may change from wlan0 to wlan1, wlan2 and so on resulting in loss of connectivity when using ifupdown-ng. To avoid this issue, create and add the following two files. The /etc/iwd/main.conf file should have:

Contents of /etc/iwd/main.conf

[DriverQuirks] DefaultInterface=wlan0

If mac address of wlan0 interface is "50:91:e3:71:83:d2", then file /etc/udev/rules.d/70-persistent-net-wlan0.rules should be as follows:

Contents of /etc/udev/rules.d/70-persistent-net-wlan0.rules

SUBSYSTEM=="net", ACTION=="add", ATTRS{address}=="50:91:e3:71:83:d2", NAME="wlan0"

The commandcat /sys/class/net/wlan0/address shows the mac address of your wireless interface wlan0.

For the above changes to take immediate effect, reload Udev rules:

# udevadm control --reload-rules # udevadm trigger

A reboot is usually necessary for the changes to fully take effect.

Service configuration

To start the iwd service immediately issue the command:

# rc-service iwd start

Once iwd service has been fully configured and tested, to have iwd service start automatically on every boot (recommended):

# rc-update add iwd boot

To avoid conflicts, ensure that wpa_supplicant service and networkmanager (if not used with iwd) are not started automatically.

Refer to openRC page for more options.

iwgtk

iwgtk showing list of networks
iwgtk

iwgtk is a wireless networking GUI for iwd 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.

To install the iwgtk package:

# 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....

The above error means that the iwd daemon is not started. Start the iwd daemon

See also