iw is the Linux command for configuring and inspecting wireless network devices, communicating with the kernel through the nl80211 netlink interface and the cfg80211 wireless subsystem. In Linux networking, it replaced the older iwconfig utility from the Wireless Extensions era and exposes modern IEEE 802.11 features such as virtual interfaces, mesh networking and detailed station statistics.
The iw command works at the wireless link layer: it shows which networks are in range, which access point a card is associated with, which channel and bandwidth are in use, and what the hardware supports. It does not assign IP addresses or handle WPA authentication, which belong to tools such as the ip command and wpa_supplicant.
How iw talks to the wireless stack
The iw utility sends netlink messages to the nl80211 family, which the kernel’s cfg80211 layer translates into calls to the wireless driver. Modern drivers built on the mac80211 framework, which implements the 802.11 MAC in software, expose nearly all iw features, while full-MAC drivers that handle the MAC in firmware may support only a subset.
iw distinguishes two kinds of objects. A phy (for example phy0) represents the physical radio and its capabilities, while a dev (for example wlan0 or wlp2s0) is a network interface created on top of that radio. One phy can host several virtual interfaces, such as a station and an access point, when the hardware allows the combination.
The table below shows how iw fits into the layered wireless architecture on Linux.
| Layer | Role | Example component |
|---|---|---|
| User-space tool | Builds and sends configuration requests | iw, wpa_supplicant, hostapd |
| nl80211 | Netlink API for wireless configuration | Generic netlink family nl80211 |
| cfg80211 | Kernel configuration and regulatory layer | Shared by all modern drivers |
| mac80211 | Software 802.11 MAC implementation | Used by many SoftMAC drivers |
| Driver and firmware | Controls the radio hardware | iwlwifi, ath9k, mt76 |
Essential iw subcommands
Most iw usage follows the pattern iw dev <interface> <command> or iw phy <phy> <command>, with a few global commands such as iw list and iw reg get. Commands that change state require root privileges or the CAP_NET_ADMIN capability, while many read-only queries work for ordinary users.
The following table lists the subcommands administrators use most often.
| Command | Purpose | Typical output |
|---|---|---|
| iw dev | Lists wireless interfaces and their phys | Interface name, type, channel, MAC address |
| iw dev wlan0 link | Shows the current association | BSSID, SSID, signal in dBm, bitrate |
| iw dev wlan0 scan | Performs an active scan for networks | BSS entries with channel and security |
| iw dev wlan0 station dump | Shows per-station statistics | Bytes, retries, signal, inactive time |
| iw list or iw phy | Displays hardware capabilities | Bands, channels, supported modes |
| iw reg get | Shows the regulatory domain | Country code and permitted power |
The output of iw is explicitly documented as not stable for scripting, because field names and layout may change between versions. Scripts that need reliable parsing should read sysfs, use a netlink library, or rely on higher-level tools such as nmcli from NetworkManager.
Interface types and operating modes
iw controls the interface type, which defines how a wireless interface behaves on the air. The command iw dev wlan0 set type monitor switches a card into monitor mode, and iw phy phy0 interface add mon0 type monitor creates an extra virtual interface without disturbing the existing station.
The supported combinations are listed under valid interface combinations in the output of iw list, and they vary considerably between chipsets. The table summarizes the common types.
| Type | Behavior | Typical use |
|---|---|---|
| managed | Client station joining an access point | Laptops and desktops on Wi-Fi |
| __ap | Access point role, normally driven by hostapd | Routers and hotspots |
| monitor | Captures all frames on a channel | Packet analysis with tcpdump |
| mesh point | IEEE 802.11s mesh participation | Community and backhaul meshes |
| IBSS | Ad hoc network without access point | Legacy peer-to-peer links |
| P2P client or GO | Wi-Fi Direct roles | Device-to-device connections |
Some types are only meaningful together with a user-space daemon. An interface can be set to the AP type, but beaconing, association handling and WPA2 or WPA3 key exchange are performed by hostapd, not by iw itself.
iw compared with related networking tools
iw covers wireless-specific configuration only, so it is usually combined with other networking tools rather than replacing them. Understanding the boundaries prevents a common mistake: expecting iw to connect to a protected network on its own.
The comparison below separates the responsibilities of iw and its closest neighbors in Linux networking.
| Tool | Scope | Handles WPA authentication |
|---|---|---|
| iw | Wireless link, modes, channels, scans | No |
| iwconfig | Legacy Wireless Extensions configuration | No, and deprecated |
| ip command | Addresses, routes, link state | No |
| wpa_supplicant | Client authentication and key management | Yes |
| nmcli and nmtui | Connection profiles through NetworkManager | Yes, through wpa_supplicant or iwd |
iw can join an open network directly with iw dev wlan0 connect <SSID>, and it can still configure static WEP keys for legacy setups. For any WPA2 or WPA3 network, however, a supplicant such as wpa_supplicant or iwd performs the four-way handshake, and iw remains useful for diagnosis.
Troubleshooting and common pitfalls
iw is a primary diagnostic tool for weak or unstable Wi-Fi because it exposes signal strength in dBm, bitrates and retry counters directly from the driver. A signal around -50 dBm is excellent, values near -70 dBm are usable for most traffic, and links below -80 dBm tend to suffer frequent retries and rate drops.
- Changing the channel or type while a manager is running often fails or is reverted, because NetworkManager or iwd reclaims the interface.
- Interface must be down for many type changes, so
ip link set wlan0 downusually precedesiw dev wlan0 set type. - Wrong regulatory domain hides channels or limits transmit power;
iw reg setonly requests a change, and the final domain may follow the access point or firmware. - Scan results may be cached or empty when the interface is busy; repeated scans or
iw dev wlan0 scan flushgive fresher data. - Power saving set with
iw dev wlan0 set power_save oncan add latency on some chipsets.
When behavior differs from expectations, checking iw list first is the decisive step, because many apparent failures are simply unsupported modes or interface combinations on that particular chipset.
Put simply
Think of a Wi-Fi card as a radio. The iw tool is the control panel for that radio on a Linux computer. It shows which networks are nearby, how strong the signal is, and which channel the radio is tuned to.
It can also switch the radio into special roles, such as listening to all nearby traffic or acting as part of a mesh. What it does not do is handle passwords or internet addresses; other tools take care of those. In short, iw manages the radio itself, not the whole connection.
In practice
A network technician at a warehouse receives complaints that handheld scanners lose connection in one aisle. Using a Linux laptop, the technician runs iw dev wlan0 link while walking the aisle and watches the signal fall from -55 dBm to -82 dBm, with the bitrate dropping from 400 Mbit/s to under 20 Mbit/s.
A scan with iw dev wlan0 scan then shows three access points on channel 6 in the 2.4 GHz band overlapping in that area. The technician creates a monitor interface with iw phy phy0 interface add mon0 type monitor and captures frames with tcpdump, confirming heavy retransmissions.
After the facility team moves one access point to channel 1 and enables 5 GHz coverage, repeated measurements show signal above -65 dBm along the whole aisle. The outcome is stable scanner connections and a documented baseline for future surveys.