Linux Wireless Interfaces with iw and nmcli

Linux Wi-Fi troubleshooting is easier when the layers are kept separate. A physical radio is represented by a PHY, a network interface such as wlan0 is created on that PHY, and a connection manager may configure that interface. iw reports the kernel’s wireless view; nmcli reports and controls NetworkManager when it is installed and running.

Discover the PHY and interface

First distinguish the device names from connection names. A profile called “Workshop Wi-Fi” is not necessarily the same thing as the interface carrying it.

# Kernel wireless inventory: PHY, interface, type, channel, and power state
iw dev

# Link-layer interfaces, including their current administrative state
ip -br link

# NetworkManager's device-oriented view, if NetworkManager is in use
nmcli device status

# Detailed properties for one interface in the lab
iw dev labwifi0 info
nmcli -f GENERAL,WIFI-PROPERTIES device show labwifi0

iw dev commonly prints a block such as phy#0, followed by Interface labwifi0 and type managed. The PHY is the radio capability domain; interfaces on it are logical operating contexts. A device can expose more than one PHY or more than one interface, so do not infer a name from a USB port or from an old tutorial.

Check radio blocks before debugging associations

A blocked radio cannot scan or connect. rfkill separates a software block, which the operating system may clear, from a hardware block such as a switch or firmware-controlled airplane mode.

rfkill list

# Only if the listing says the block is soft and this is your lab device:
rfkill unblock wifi

# Confirm both the radio and NetworkManager's Wi-Fi state afterwards
rfkill list
nmcli radio wifi

If Hard blocked: yes remains, an rfkill unblock command cannot override it. Check the device’s documented switch, BIOS/UEFI setting, or platform radio key. On systems managed by NetworkManager, nmcli radio wifi on changes NetworkManager’s radio policy; it does not repair a hardware block.

Use NetworkManager profiles deliberately

Where NetworkManager is responsible for the interface, let it own ordinary managed connections rather than mixing manual address configuration with an active profile.

# Read existing profiles and the active profile on labwifi0
nmcli connection show
nmcli -f GENERAL.CONNECTION,GENERAL.STATE device show labwifi0

# Show networks advertised to your lab adapter. This asks the radio to scan.
nmcli device wifi list ifname labwifi0 --rescan auto

# Activate an existing, authorized lab profile by profile name
nmcli connection up id "Lab AP" ifname labwifi0

# Disconnect without deleting its saved profile
nmcli device disconnect labwifi0

The profile contains policy such as addressing, DNS, and security settings; the device is the current hardware interface. connection up may choose a suitable device unless ifname is supplied. Supplying it makes a lab change less surprising on a machine with several adapters.

Scan responsibly

Scanning is normal Wi-Fi behavior, but it transmits probe activity and can briefly interrupt a busy or power-sensitive link. Scan only from equipment you administer, avoid repeated polling, and prefer a short observation window during a maintenance period. Passive observations and the results already cached by the connection manager are often enough.

# Read the current link without initiating a scan
iw dev labwifi0 link

# Display NetworkManager's known access-point list without forced refresh
nmcli device wifi list ifname labwifi0 --rescan no

# Inspect capabilities and current regulatory information
iw phy phy0 info
iw reg get

iw dev … link reports Not connected. or details such as SSID, BSSID, frequency, RX/TX bitrate, and signal. Signal is a momentary value, not a promise of throughput. A low bitrate can reflect distance, interference, power saving, or rate adaptation; compare it with packet loss and time rather than treating one sample as a diagnosis. Do not change the regulatory domain merely to expose channels: use the legally correct setting for the equipment’s location.

Read-only diagnostics that narrow the problem

# Association, address, route, and resolver state
iw dev labwifi0 link
ip addr show dev labwifi0
ip route
nmcli -f IP4,DHCP4,DNS device show labwifi0

# Counters and wireless statistics, if the driver supplies them
ip -s link show dev labwifi0
iw dev labwifi0 station dump

# Hardware identity and bound kernel driver
lspci -nnk 2>/dev/null || true
lsusb
ethtool -i labwifi0 2>/dev/null || true

station dump is most useful when this interface is acting as an access point; in managed mode it may be empty or show limited peer information. ip -s link counters identify a trend, but do not by themselves prove an RF fault. Likewise, a valid IP address with no useful route points to a different layer than a failed association.

Driver and firmware clues

Firmware is code loaded into many wireless devices by the kernel driver. A driver can bind successfully while the radio remains unavailable because required firmware is missing, rejected, or incompatible. The exact package name and firmware path vary by distribution and hardware, so record facts before applying an operating-system-specific remedy.

# Kernel messages for this boot, filtered to likely wireless/firmware clues
journalctl -k -b | grep -Ei 'wifi|wlan|802\.11|firmware|iwl|ath|brcm|rtw'

# Module and driver information when a driver name is known
ethtool -i labwifi0 2>/dev/null
modinfo DRIVER_NAME 2>/dev/null

Look for the adapter identifier, driver name, firmware filename, and a clear load failure or timeout. Preserve that information with the kernel version before updating firmware or changing modules. A message about a country code, unsupported band, or RF kill may be more relevant than a generic “link down” message.

Restore a normal managed connection

Finish experiments by returning the lab adapter to the connection manager and reconnecting the intended profile. This avoids leaving a laptop unexpectedly offline.

# Re-enable NetworkManager's Wi-Fi policy if you disabled it during testing
nmcli radio wifi on

# Reconnect the saved lab profile on the intended interface
nmcli connection up id "Lab AP" ifname labwifi0

# Verify the final state
nmcli device status
iw dev labwifi0 link

If NetworkManager is not the service managing your system, do not start it merely for these commands; use the system’s existing network-management method. The companion monitor-mode capture article explains why mode changes deserve an isolated lab and a cleanup plan.

References