LinuxCommandLibrary

iw-dev

Configure wireless devices

TLDR

Set device to monitor mode (interface must be down first. See also: ip link)

$ sudo iw dev [wlp] set type monitor
copy

Set device to managed mode (interface must be down first)
$ sudo iw dev [wlp] set type managed
copy

Set device Wi-Fi channel (device must first be in monitor mode with the interface up)
$ sudo iw dev [wlp] set channel [channel_number]
copy

Set device Wi-Fi frequency in Mhz (device must first be in monitor mode with the interface up)
$ sudo iw dev [wlp] set freq [freq_in_mhz]
copy

Show all known station info
$ iw dev [wlp] station dump
copy

Create a virtual interface in monitor mode with a specific MAC address
$ sudo iw dev [wlp] interface add "[vif_name]" type monitor addr [12:34:56:aa:bb:cc]
copy

Delete virtual interface
$ sudo iw dev "[vif_name]" del
copy

SYNOPSIS

iw dev
[<devname>] { info | set [ type <type> ] [ power_save on|off ] [ txpower fixed|auto [<mBm>] ] [ mac <options> ] }

PARAMETERS

info
    Display detailed info on specified device: capabilities, settings, stats.

set type <type>
    Change interface type: managed, monitor, ap, mesh, ibss, wds, etc.

set power_save on|off
    Enable/disable power saving mode.

set txpower fixed <mBm>
    Set fixed TX power upper bound (milliBm); hardware limits apply.

set txpower auto
    Reset TX power to hardware default.

set mac address random [<addr>]|permanent|once
    Configure MAC randomization: random addr, persistent across reboots, or per-assoc.

DESCRIPTION

iw dev is a subcommand of the iw utility for displaying and configuring wireless devices on Linux systems using the nl80211 netlink interface from cfg80211/mac80211. Running iw dev without arguments lists all detected wireless interfaces with basic info like name, type, channel, and TX power.

It retrieves detailed device information via info, including hardware capabilities (e.g., supported bands, rates, encryption), current settings (mode, SSID association, signal quality), and statistics. Configuration options include setting interface type for modes like monitor (packet sniffing), AP (access point), or mesh; toggling power save; adjusting TX power (fixed or auto, in mBm); and MAC randomization for privacy (random, permanent, or once per association).

Essential for Wi-Fi admins, it's used in scripting, monitor mode setup for tcpdump/Wireshark, hotspot creation, or debugging. Requires root, works only with compatible drivers (e.g., ath9k, iwlwifi). Supersedes deprecated iwconfig/Wireless Extensions for modern kernels.

CAVEATS

Requires root privileges.
Features depend on driver/hardware support (cfg80211 only).
Cannot change type on active (up) interfaces without flags.
TX power bounded by regulatory domain.

EXAMPLES

iw dev (list devices)
iw dev wlan0 info (device details)
iw dev wlan0 set type monitor (monitor mode)
iw dev wlan0 set power_save off (disable PS)

TYPE OPTIONS

managed, ibss, monitor, mesh_point, AP, WDS, AP_VLAN, P2P-client, P2P-GO, P2P-device, ocb, nan.

HISTORY

iw developed by Jiri Benc ~2008 for nl80211 in Linux 2.6.24+, replacing Wireless Extensions. Actively maintained in wireless-next tree; dev subcommand core since inception for device enumeration/config.

SEE ALSO

iw(8), iwconfig(8), iwphy(8), ip(8), wpa_supplicant(8)

Copied to clipboard