How to connect to Wifi using nmcli

Tuesday, 18 May 2021

Something I’ve been enjoying on OpenBSD is the relative simplicity of wifi networking compared to Linux. In OpenBSD, you put your SSID details inside /etc/hostname.iwm0 or similar (depends on driver name for your interface). Check out hostname.if(5).

I forgot about this when revisiting my Debian laptops recently. I’ve used various means of connecting to wifi on Linux in the past, but currently I’m using NetworkManager, and I find it a pain to use. The API for nmcli is a disaster area in my view.

I used this web site to finally crack it (thanks!):

# nmcli radio
WIFI-HW  WIFI     WWAN-HW  WWAN
enabled  enabled  enabled  enabled
# nmcli device
DEVICE  TYPE      STATE         CONNECTION
wlan0   wifi      disconnected  --
eth0    ethernet  unavailable   --
lo      loopback  unmanaged     --

Then to actually connect to a wireless AP:

# nmcli device wifi rescan
# nmcli device wifi list
# nmcli device wifi connect SSID-Name --ask

Do not darken my doors ever again.

This post is untagged.

© 2024 MR Lemon