Monitor events from the kernel.
-t - print timestamp
-r - print relative timstamp
-f - print full frame for auth/assoc etc.
/tmp # iw event -f
ap5g: del station 70:ef:00:af:31:52
ap5g (phy #1): mgmt TX status (cookie bbe): no ack
ap5g (phy #1): mgmt TX status (cookie bbf): acked
ap5g: new station 70:ef:00:af:31:52
ap5g (phy #1): mgmt TX status (cookie bc0): acked
ap5g (phy #1): mgmt TX status (cookie bc1): acked
Show capabilities for the specified wireless device.
/tmp # iw phy phy0 info
Wiphy phy0
max # scan SSIDs: 16
max scan IEs length: 195 bytes
max # sched scan SSIDs: 0
max # match sets: 0
max # scan plans: 1
max scan plan interval: -1
max scan plan iterations: 0
Retry short limit: 7
Retry long limit: 4
Coverage class: 0 (up to 0m)
Device supports RSN-IBSS.
Device supports AP-side u-APSD.
Supported Ciphers:
* WEP40 (00-0f-ac:1)
* WEP104 (00-0f-ac:5)
* TKIP (00-0f-ac:2)
* CCMP-128 (00-0f-ac:4)
* CMAC (00-0f-ac:6)
* CMAC-256 (00-0f-ac:13)
* GMAC-128 (00-0f-ac:11)
* GMAC-256 (00-0f-ac:12)
* GCMP-128 (00-0f-ac:8)
* GCMP-256 (00-0f-ac:9)
* CCMP-256 (00-0f-ac:10)
Available Antennas: TX 0x3 RX 0x3
Configured Antennas: TX 0x3 RX 0x3
Supported interface modes:
* IBSS
* managed
* AP
* monitor
* mesh point
* P2P-client
* P2P-GO
* P2P-device
Band 1:
Capabilities: 0x19ef
RX LDPC
HT20/HT40
SM Power Save disabled
RX HT20 SGI
RX HT40 SGI
TX STBC
RX STBC 1-stream
Max AMSDU length: 7935 bytes
DSSS/CCK HT40
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
Minimum RX AMPDU time spacing: 8 usec (0x06)
HT TX/RX MCS rate indexes supported: 0-15
VHT Capabilities (0x339959b2):
Max MPDU length: 11454
Supported Channel Width: neither 160 nor 80+80
RX LDPC
short GI (80 MHz)
TX STBC
SU Beamformer
SU Beamformee
MU Beamformer
MU Beamformee
RX antenna pattern consistency
TX antenna pattern consistency
VHT RX MCS set:
1 streams: MCS 0-9
2 streams: MCS 0-9
3 streams: not supported
4 streams: not supported
5 streams: not supported
6 streams: not supported
7 streams: not supported
8 streams: not supported
VHT RX highest supported: 0 Mbps
VHT TX MCS set:
1 streams: MCS 0-9
2 streams: MCS 0-9
3 streams: not supported
4 streams: not supported
5 streams: not supported
6 streams: not supported
7 streams: not supported
8 streams: not supported
VHT TX highest supported: 0 Mbps
Bitrates (non-HT):
* 1.0 Mbps
* 2.0 Mbps (short preamble supported)
* 5.5 Mbps (short preamble supported)
* 11.0 Mbps (short preamble supported)
* 6.0 Mbps
* 9.0 Mbps
* 12.0 Mbps
* 18.0 Mbps
* 24.0 Mbps
* 36.0 Mbps
* 48.0 Mbps
* 54.0 Mbps
Frequencies:
* 2412 MHz [1] (30.0 dBm)
* 2417 MHz [2] (30.0 dBm)
* 2422 MHz [3] (30.0 dBm)
* 2427 MHz [4] (30.0 dBm)
* 2432 MHz [5] (30.0 dBm)
* 2437 MHz [6] (30.0 dBm)
* 2442 MHz [7] (30.0 dBm)
* 2447 MHz [8] (30.0 dBm)
* 2452 MHz [9] (30.0 dBm)
* 2457 MHz [10] (30.0 dBm)
* 2462 MHz [11] (30.0 dBm)
* 2467 MHz [12] (disabled)
* 2472 MHz [13] (disabled)
* 2484 MHz [14] (disabled)
Supported commands:
* new_interface
* set_interface
* new_key
* start_ap
* new_station
* new_mpath
* set_mesh_config
* set_bss
* authenticate
* associate
* deauthenticate
* disassociate
* join_ibss
* join_mesh
* remain_on_channel
* set_tx_bitrate_mask
* frame
* frame_wait_cancel
* set_wiphy_netns
* set_channel
* set_wds_peer
* probe_client
* set_noack_map
* register_beacons
* start_p2p_device
* set_mcast_rate
* testmode
* connect
* disconnect
* channel_switch
* set_qos_map
* set_multicast_to_unicast
Supported TX frame types:
* IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
Supported RX frame types:
* IBSS: 0x40 0xb0 0xc0 0xd0
* managed: 0x40 0xd0
* AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
* AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
* mesh point: 0xb0 0xc0 0xd0
* P2P-client: 0x40 0xd0
* P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
* P2P-device: 0x40 0xd0
software interface modes (can always be added):
* monitor
valid interface combinations:
* #{ managed } <= 16, #{ AP, mesh point } <= 16, #{ IBSS } <= 1,
total <= 16, #channels <= 1, STA/AP BI must match, radar detect widths: { 20 MHz (no HT), 20 MHz, 40 MHz, 80 MHz }
HT Capability overrides:
* MCS: ff ff ff ff ff ff ff ff ff ff
* maximum A-MSDU length
* supported channel width
* short GI for 40 MHz
* max A-MPDU length exponent
* min MPDU start spacing
Device supports TX status socket option.
Device supports HT-IBSS.
Device supports SAE with AUTHENTICATE command
Device supports scan flush.
Device supports AP scan.
Device supports per-vif TX power setting
Driver supports full state transitions for AP/GO clients
Driver supports a userspace MPM
Driver/device bandwidth changes during BSS lifetime (AP/GO mode)
Device supports static SMPS
Device supports configuring vdev MAC-addr on create.
Supported extended features:
* [ VHT_IBSS ]: VHT-IBSS
* [ RRM ]: RRM
* [ SET_SCAN_DWELL ]: scan dwell setting
* [ CQM_RSSI_LIST ]: multiple CQM_RSSI_THOLD records
* [ CONTROL_PORT_OVER_NL80211 ]: control port over nl80211
* [ TXQS ]: FQ-CoDel-enabled intermediate TXQs
List all wireless devices and their capabilities.
list all known commands and their decimal & hex value
/tmp # iw commands
1 (0x1): get_wiphy
2 (0x2): set_wiphy
3 (0x3): new_wiphy
4 (0x4): del_wiphy
5 (0x5): get_interface
6 (0x6): set_interface
7 (0x7): new_interface
8 (0x8): del_interface
9 (0x9): get_key
10 (0xa): set_key
11 (0xb): new_key
12 (0xc): del_key
13 (0xd): get_beacon
14 (0xe): set_beacon
15 (0xf): start_ap
16 (0x10): stop_ap
17 (0x11): get_station
18 (0x12): set_station
19 (0x13): new_station
20 (0x14): del_station
21 (0x15): get_mpath
22 (0x16): set_mpath
23 (0x17): new_mpath
24 (0x18): del_mpath
25 (0x19): set_bss
26 (0x1a): set_reg
27 (0x1b): req_set_reg
28 (0x1c): get_mesh_config
29 (0x1d): set_mesh_config
30 (0x1e): Unknown command (30)
31 (0x1f): get_reg
32 (0x20): get_scan
33 (0x21): trigger_scan
34 (0x22): new_scan_results
35 (0x23): scan_aborted
36 (0x24): reg_change
37 (0x25): authenticate
38 (0x26): associate
39 (0x27): deauthenticate
40 (0x28): disassociate
41 (0x29): michael_mic_failure
42 (0x2a): reg_beacon_hint
43 (0x2b): join_ibss
44 (0x2c): leave_ibss
45 (0x2d): testmode
46 (0x2e): connect
47 (0x2f): roam
48 (0x30): disconnect
49 (0x31): set_wiphy_netns
50 (0x32): get_survey
51 (0x33): new_survey_results
52 (0x34): set_pmksa
53 (0x35): del_pmksa
54 (0x36): flush_pmksa
55 (0x37): remain_on_channel
56 (0x38): cancel_remain_on_channel
57 (0x39): set_tx_bitrate_mask
58 (0x3a): register_frame
59 (0x3b): frame
60 (0x3c): frame_tx_status
61 (0x3d): set_power_save
62 (0x3e): get_power_save
63 (0x3f): set_cqm
64 (0x40): notify_cqm
65 (0x41): set_channel
66 (0x42): set_wds_peer
67 (0x43): frame_wait_cancel
68 (0x44): join_mesh
69 (0x45): leave_mesh
70 (0x46): unprot_deauthenticate
71 (0x47): unprot_disassociate
72 (0x48): new_peer_candidate
73 (0x49): get_wowlan
74 (0x4a): set_wowlan
75 (0x4b): start_sched_scan
76 (0x4c): stop_sched_scan
77 (0x4d): sched_scan_results
78 (0x4e): sched_scan_stopped
79 (0x4f): set_rekey_offload
80 (0x50): pmksa_candidate
81 (0x51): tdls_oper
82 (0x52): tdls_mgmt
83 (0x53): unexpected_frame
84 (0x54): probe_client
85 (0x55): register_beacons
86 (0x56): unexpected_4addr_frame
87 (0x57): set_noack_map
88 (0x58): ch_switch_notify
89 (0x59): start_p2p_device
90 (0x5a): stop_p2p_device
91 (0x5b): conn_failed
92 (0x5c): set_mcast_rate
93 (0x5d): set_mac_acl
94 (0x5e): radar_detect
95 (0x5f): get_protocol_features
96 (0x60): update_ft_ies
97 (0x61): ft_event
98 (0x62): crit_protocol_start
99 (0x63): crit_protocol_stop
100 (0x64): get_coalesce
101 (0x65): set_coalesce
102 (0x66): channel_switch
103 (0x67): vendor
104 (0x68): set_qos_map
105 (0x69): add_tx_ts
106 (0x6a): del_tx_ts
107 (0x6b): get_mpp
108 (0x6c): join_ocb
109 (0x6d): leave_ocb
110 (0x6e): ch_switch_started_notify
111 (0x6f): tdls_channel_switch
112 (0x70): tdls_cancel_channel_switch
113 (0x71): wiphy_reg_change
114 (0x72): abort_scan
115 (0x73): start_nan
116 (0x74): stop_nan
117 (0x75): add_nan_function
118 (0x76): del_nan_function
119 (0x77): change_nan_config
120 (0x78): nan_match
121 (0x79): set_multicast_to_unicast
122 (0x7a): update_connect_params
123 (0x7b): set_pmk
124 (0x7c): del_pmk
125 (0x7d): port_authorized
126 (0x7e): reload_regdb
127 (0x7f): external_auth
128 (0x80): sta_opmode_changed
129 (0x81): control_port_frame
130 (0x82): get_ftm_responder_stats
131 (0x83): peer_measurement_start
132 (0x84): peer_measurement_result
133 (0x85): peer_measurement_complete
134 (0x86): notify_radar
Show available channels.
/tmp # iw phy phy0 channels
Band 1:
* 2412 MHz [1]
Maximum TX power: 30.0 dBm
Channel widths: 20MHz HT40+
* 2417 MHz [2]
Maximum TX power: 30.0 dBm
Channel widths: 20MHz HT40+
* 2422 MHz [3]
Maximum TX power: 30.0 dBm
Channel widths: 20MHz HT40+
* 2427 MHz [4]
Maximum TX power: 30.0 dBm
Channel widths: 20MHz HT40+
* 2432 MHz [5]
Maximum TX power: 30.0 dBm
Channel widths: 20MHz HT40- HT40+
* 2437 MHz [6]
Maximum TX power: 30.0 dBm
Channel widths: 20MHz HT40- HT40+
* 2442 MHz [7]
Maximum TX power: 30.0 dBm
Channel widths: 20MHz HT40- HT40+
* 2447 MHz [8]
Maximum TX power: 30.0 dBm
Channel widths: 20MHz HT40-
* 2452 MHz [9]
Maximum TX power: 30.0 dBm
Channel widths: 20MHz HT40-
* 2457 MHz [10]
Maximum TX power: 30.0 dBm
Channel widths: 20MHz HT40-
* 2462 MHz [11]
Maximum TX power: 30.0 dBm
Channel widths: 20MHz HT40-
* 2467 MHz [12] (disabled)
* 2472 MHz [13] (disabled)
* 2484 MHz [14] (disabled)
phy <phyname> interface add <name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] [addr <mac-addr>]
Add a new virtual interface with the given configuration.
Valid interface types are: managed, ibss, monitor, mesh, wds.
The flags are only used for monitor interfaces, valid flags are:
none: no special flags
fcsfail: show frames with FCS errors
control: show control frames
otherbss: show frames from other BSSes
cook: use cooked mode
active: use active mode (ACK incoming unicast packets)
mumimo-groupid <GROUP_ID>: use MUMIMO according to a group id
mumimo-follow-mac <MAC_ADDRESS>: use MUMIMO according to a MAC address
The mesh_id is used only for mesh mode.
/tmp # iw phy phy1 interface add sta20 type managed addr 00:00:00:00:00:a0
/tmp #
dev <devname> del
Remove this virtual interface
/tmp # iw dev sta20 del
/tmp #
dev <devname> info
Show information for this interface.
/tmp # iw dev sta10 info
Interface sta10
ifindex 7
wdev 0x2
addr 00:03:7f:12:34:56
type managed
wiphy 0
txpower 0.00 dBm
multicast TXQ:
qsz-byt qsz-pkt flows drops marks overlmt hashcol tx-bytes tx-packets
0 0 0 0 0 0 0 0 0
/tmp # iw dev ap5g info
Interface ap5g
ifindex 5
wdev 0x100000001
addr 12:34:56:78:90:12
ssid test
type AP
wiphy 1
channel 44 (5220 MHz), width: 20 MHz (no HT), center1: 5220 MHz
txpower 23.00 dBm
multicast TXQ:
qsz-byt qsz-pkt flows drops marks overlmt hashcol tx-bytes tx-packets
0 0 29909 0 0 0 0 3063111 29914
dev
List all network interfaces for wireless hardware.
/tmp # iw dev
phy#1
Interface ap5g
ifindex 5
wdev 0x100000001
addr 12:34:56:78:90:12
ssid test
type AP
channel 44 (5220 MHz), width: 20 MHz (no HT), center1: 5220 MHz
txpower 23.00 dBm
multicast TXQ:
qsz-byt qsz-pkt flows drops marks overlmt hashcol tx-bytes tx-packets
0 0 29923 0 0 0 0 3065035 29928
phy#0
Interface sta10
ifindex 7
wdev 0x2
addr 00:03:7f:12:34:56
type managed
txpower 0.00 dBm
multicast TXQ:
qsz-byt qsz-pkt flows drops marks overlmt hashcol tx-bytes tx-packets
0 0 0 0 0 0 0 0 0
Interface wlan10
ifindex 6
wdev 0x1
addr 00:03:7f:12:34:56
type managed
txpower 0.00 dBm
multicast TXQ:
qsz-byt qsz-pkt flows drops marks overlmt hashcol tx-bytes tx-packets
0 0 0 0 0 0 0 0 0
dev <devname> station dump [-v]
List all stations known, e.g. the AP on managed interfaces
/tmp # iw dev ap5g station dump
Station 70:ef:00:af:31:52 (on ap5g)
inactive time: 7600 ms
rx bytes: 8262163
rx packets: 80911
tx bytes: 122851342
tx packets: 89686
tx retries: 0
tx failed: 1438
rx drop misc: 87
signal: -34 [-36, -38, -95, -95] dBm
signal avg: -34 [-36, -38, -95, -95] dBm
tx bitrate: 2.8 MBit/s
rx bitrate: 24.0 MBit/s
rx duration: 62868000 us
last ack signal:-36 dBm
authorized: yes
authenticated: yes
associated: yes
preamble: long
WMM/WME: no
MFP: no
TDLS peer: no
DTIM period: 2
beacon interval:100
short slot time:yes
connected time: 2332 seconds
dev <devname> station get <MAC address>
Get information for a specific station.
/tmp # iw dev ap5g station get 70:ef:00:af:31:52
Station 70:ef:00:af:31:52 (on ap5g)
inactive time: 1530 ms
rx bytes: 8280669
rx packets: 81045
tx bytes: 122872864
tx packets: 89740
tx retries: 0
tx failed: 1438
rx drop misc: 87
signal: -34 [-37, -38, -95, -95] dBm
signal avg: -33 [-36, -37, -95, -95] dBm
tx bitrate: 2.8 MBit/s
rx bitrate: 24.0 MBit/s
rx duration: 63948000 us
last ack signal:-34 dBm
authorized: yes
authenticated: yes
associated: yes
preamble: long
WMM/WME: no
MFP: no
TDLS peer: no
DTIM period: 2
beacon interval:100
short slot time:yes
connected time: 2371 seconds
dev <devname> station del <MAC address> [subtype <subtype>] [reason-code <code>]
Remove the given station entry (use with caution!)
Example subtype values: 0xA (disassociation), 0xC (deauthentication)
/tmp # iw dev ap5g station del 70:ef:00:af:31:52
/tmp #
扫描ssid,trigger的话,在后台执行
dev <devname> scan [-u] [freq <freq>*] [duration <dur>] [ies <hex as 00:11:..>] [meshid <meshid>] [lowpri,flush,ap-force,duration-mandatory] [randomise[=<addr>/<mask>]] [ssid <ssid>*|passive]
Scan on the given frequencies and probe for the given SSIDs
(or wildcard if not given) unless passive scanning is requested.
If -u is specified print unknown data in the scan results.
Specified (vendor) IEs must be well-formed.
dev <devname> scan dump [-u]
Dump the current scan results. If -u is specified, print unknown
data in scan results.
dev <devname> scan trigger [freq <freq>*] [duration <dur>] [ies <hex as 00:11:..>] [meshid <meshid>] [lowpri,flush,ap-force,duration-mandatory] [randomise[=<addr>/<mask>]] [ssid <ssid>*|passive]
Trigger a scan on the given frequencies with probing for the given
SSIDs (or wildcard if not given) unless passive scanning is requested.
Duration(in TUs), if specified, will be used to set dwell times.
/tmp # iw dev sta10 scan
BSS fc:7c:02:9b:a4:5f(on sta10)
TSF: 94721345460 usec (1d, 02:18:41)
freq: 2422
beacon interval: 100 TUs
capability: ESS Privacy ShortSlotTime APSD (0x0c11)
signal: -50.00 dBm
last seen: 480 ms ago
Information elements from Probe Response frame:
SSID: @PHICOMM_2710
Supported rates: 1.0* 2.0* 5.5* 11.0* 9.0 18.0 36.0 54.0
DS Parameter set: channel 3
ERP: Barker_Preamble_Mode
Extended supported rates: 6.0 12.0 24.0 48.0
HT capabilities:
Capabilities: 0x11ee
HT20/HT40
SM Power Save disabled
RX HT20 SGI
RX HT40 SGI
TX STBC
RX STBC 1-stream
Max AMSDU length: 3839 bytes
DSSS/CCK HT40
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
Minimum RX AMPDU time spacing: 4 usec (0x05)
HT RX MCS rate indexes supported: 0-15, 32
HT TX MCS rate indexes are undefined
HT operation:
* primary channel: 3
* secondary channel offset: no secondary
* STA channel width: 20 MHz
* RIFS: 0
* HT protection: 20 MHz
* non-GF present: 1
* OBSS non-GF present: 0
* dual beacon: 0
* dual CTS protection: 0
* STBC beacon: 0
* L-SIG TXOP Prot: 0
* PCO active: 0
* PCO phase: 0
WPA: * Version: 1
* Group cipher: TKIP
* Pairwise ciphers: TKIP CCMP
* Authentication suites: PSK
RSN: * Version: 1
* Group cipher: TKIP
* Pairwise ciphers: TKIP CCMP
* Authentication suites: PSK
* Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000)
WMM: * Parameter version 1
* u-APSD
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS Load:
* station count: 4
* channel utilisation: 53/255
* available admission capacity: 31250 [*32us]
Overlapping BSS scan params:
* passive dwell: 20 TUs
* active dwell: 10 TUs
* channel width trigger scan interval: 300 s
* scan passive total per channel: 200 TUs
* scan active total per channel: 20 TUs
* BSS width channel transition delay factor: 5
* OBSS Scan Activity Threshold: 0.25 %
Extended capabilities:
* HT Information Exchange Supported
Country: CN Environment: Indoor/Outdoor
Channels [1 - 13] @ 16 dBm
phy <phyname> set freq <freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]
phy <phyname> set freq <control freq> [5|10|20|40|80|80+80|160] [<center1_freq> [<center2_freq>]]
Set frequency/channel the hardware is using, including HT
configuration.
dev <devname> set freq <freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]
dev <devname> set freq <control freq> [5|10|20|40|80|80+80|160] [<center1_freq> [<center2_freq>]]
phy <phyname> set channel <channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]
dev <devname> set channel <channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]
/tmp # iw phy phy0 interface add mon0 type monitor
/tmp # iw phy phy0 set channel 3
command failed: Device or resource busy (-16)
/tmp # ifconfig mon0 up
[694616.544587] ath10k_ahb a000000.wifi: 10.4 wmi init: vdevs: 16 peers: 48 tid: 96
[694616.544632] ath10k_ahb a000000.wifi: msdu-desc: 2500 skid: 32
[694616.580059] ath10k_ahb a000000.wifi: wmi print 'P 48/48 V 16 K 144 PH 176 T 186 msdu-desc: 2500 sw-crypt: 0 ct-sta: 0'
[694616.583100] ath10k_ahb a000000.wifi: wmi print 'free: 56576 iram: 23368 sram: 35968'
[694617.121791] ath10k_ahb a000000.wifi: Firmware lacks feature flag indicating a retry limit of > 2 is OK, requested limit: 4
/tmp # iw phy phy0 set channel 3
注意:这里需要up接口,才能设置channel。