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 WiFi channel (device must first be in monitor mode with the interface up)
$ sudo iw dev [wlp] set channel [channel_number]
copy

Set device WiFi 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 [OPTIONS] command

PARAMETERS

-d
    Enable debugging output.

-v
    Enable verbose output.

command
    The specific command to execute (e.g., scan, info, get_tx_power, etc.). Refer to iw-dev help for a comprehensive list of available commands.

DESCRIPTION

The iw-dev command is a powerful Linux tool designed for configuring and diagnosing wireless network interfaces at a low level, primarily targeting developers and advanced users.

It allows direct manipulation of wireless devices, bypassing some of the higher-level network management abstractions like NetworkManager or wpa_supplicant. This grants greater control over hardware settings, enabling tasks such as scanning for specific 802.11 channels, setting transmit power levels, managing power saving modes, and examining detailed driver statistics.

iw-dev can be particularly useful for debugging driver issues, testing new wireless hardware, or implementing custom wireless protocols. Because of its low-level nature, improper use can disrupt network connectivity or even damage hardware, so a strong understanding of wireless networking principles is recommended before using this command.

CAVEATS

Directly manipulating wireless hardware can have unintended consequences. Incorrect settings can disrupt network connectivity, reduce performance, or even cause hardware damage. Use with caution and consult hardware documentation. Requires root privileges in most cases.

COMMAND LIST

iw-dev offers a variety of commands to interact with wireless interfaces. Common command examples are: scan, get_channel, set_power_save, get_tx_power, set_tx_power, get_wiphy, survey dump, link, tx.

NETLINK INTERFACE

iw-dev makes extensive use of the Netlink interface to communicate with the Linux kernel's wireless subsystem. Understanding Netlink can be helpful when troubleshooting or developing wireless applications using iw-dev.

HISTORY

iw-dev evolved from older tools like iwconfig, providing a more modern and flexible interface for interacting with wireless devices using the nl80211 Netlink interface. It's primarily intended for developers and advanced users who need fine-grained control over wireless hardware for testing, debugging, and custom protocol development.

SEE ALSO

iw(8), iwconfig(8), rfkill(1), wpa_supplicant(8)

Copied to clipboard