Connect to WiFi with iwctl (iNet wireless daemon)

Part of the Arch Linux appeal is how minimal it is, so minimal that you have to manually connect to WiFi with iwctl. The iNet Wireless Daemon comes a set of command-line tools for interacting with your wireless network card, and wireless routers. Using these tools, we’ll be able to connect to a wireless network with only a few easy steps.

While this isn’t necessarily something you’d need to do if you install a desktop environment like GNOME or KDE, but it definitely comes into play during the installation of Arch Linux, which is as pared down as it gets.

Since I don’t setup Arch very often, maybe once a year or so less, I tend to
forget how to connect to the Internet during the initial setup. Previously this
was done with netctl by way of the wifi-menu command. It used to be a very straight forward process. Simply execute the wifi-menu command and run through the prompts, answering things along the way.

Sadly, wifi-menu doesn’t seem to be bundled as part of the base Arch Linux image any longer.

Launch the prompt

What is included is the iNet wireless daemon (iwd) which gives us the iwctl
command. Upon running iwctl you are dropped into the iwd interactive
prompt:

$ iwctl

[iwd]#
Zsh

Connect to WiFi

From the [iwd]# prompt you will need figure out your device name. Then, assuming you know the SSID (service set identifier) of your wireless network, go ahead and connect like so:

[iwd]# device list

# You should see something like this:
#
#                            Devices
# -------------------------------------------------------------
#   Name          Address          Powered    Adapter    Mode
# -------------------------------------------------------------
#   wlan0         ...              on         ...        ...

[iwd]# station YOURDEVICE connect YOURSSID
Zsh

For a secured wireless network, you will be prompted for the WiFi password. Once you enter the correct password, you’ll be off to the races!

Of course, if you don’t know the SSID for the network you’re connecting to, you
can scan for available networks:

[iwd]# station YOURDEVICE scan
Zsh

Disconnect from WiFi

Once you’re done with needing Internet access, you can tell iwd that you’d like to disconnect. Armed with the device name of your wireless network card, simply run:

[iwd]# station YOURDEVICE disconnect
Zsh
Josh Sherman - The Man, The Myth, The Avatar

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.


If you found this article helpful, please consider buying me a coffee.