以前使用iwconfig来配置和获取wireless的信息,目前openwrt已经废弃这种方式,采用 iwinfo 和 iw 命令来进行替代。
iwinfo的使用方法如下:
root@hbg:/# iwinfo -h
Usage:
iwinfo <device> info // 查看设备信息
iwinfo <device> scan // 扫描周围ssid
iwinfo <device> txpowerlist // 设备发送功率及当前的使用功率
iwinfo <device> freqlist // 设备的信道以及当前使用的信道
iwinfo <device> assoclist // 关联的终端信息
iwinfo <device> countrylist // 国家信息
root@hbg:/#
例子如下:
root@hbg:/# iwinfo wlan0 info
wlan0 ESSID: "mytvws" // ESSID
Access Point: 78:C2:C0:E3:00:4D // BSSID
Mode: Master Channel: 1 (2.412 GHz) // 模式、信道
Tx-Power: 5 dBm Link Quality: unknown/70 // 发送功率
Signal: unknown Noise: -95 dBm // 信号、噪声
Bit Rate: unknown
Encryption: WPA2 PSK (CCMP) // 加密方式
Type: nl80211 HW Mode(s): 802.11bgn // 802.11模式
Hardware: unknown [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
root@hbg:/#
root@hbg:/# iwinfo wlan0 scan
Cell 01 - Address: 00:22:AA:91:C2:48 // BSSID
ESSID: "Huwomo" // ESSID
Mode: Master Channel: 2 // 模式、信道
Signal: -73 dBm Quality: 37/70 // 信号
Encryption: mixed WPA/WPA2 PSK (TKIP, CCMP) //加密方式
Cell 02 - Address: 00:22:AA:01:BD:A8
ESSID: "UTT-HIPER_DEAC84"
Mode: Master Channel: 4
Signal: -79 dBm Quality: 31/70
Encryption: none
root@hbg:/# iwinfo wlan0 txpowerlist
0 dBm ( 1 mW)
1 dBm ( 1 mW)
2 dBm ( 1 mW)
3 dBm ( 1 mW)
4 dBm ( 2 mW)
* 5 dBm ( 3 mW) // 当前使用的功率
6 dBm ( 3 mW)
7 dBm ( 5 mW)
8 dBm ( 6 mW)
9 dBm ( 7 mW)
10 dBm ( 10 mW)
11 dBm ( 12 mW)
12 dBm ( 15 mW)
13 dBm ( 19 mW)
14 dBm ( 25 mW)
15 dBm ( 31 mW)
16 dBm ( 39 mW)
17 dBm ( 50 mW)
18 dBm ( 63 mW)
19 dBm ( 79 mW)
20 dBm ( 100 mW)
21 dBm ( 125 mW)
22 dBm ( 158 mW)
23 dBm ( 199 mW)
24 dBm ( 251 mW)
25 dBm ( 316 mW)
26 dBm ( 398 mW)
27 dBm ( 501 mW)
28 dBm ( 630 mW)
29 dBm ( 794 mW)
30 dBm (1000 mW)
root@hbg:/#
root@hbg:/# iwinfo wlan0 freqlist
* 2.412 GHz (Channel 1) // 当前使用的信道
2.417 GHz (Channel 2)
2.422 GHz (Channel 3)
2.427 GHz (Channel 4)
2.432 GHz (Channel 5)
2.437 GHz (Channel 6)
2.442 GHz (Channel 7)
2.447 GHz (Channel 8)
2.452 GHz (Channel 9)
2.457 GHz (Channel 10)
2.462 GHz (Channel 11)
root@hbg:/#
root@hbg:/# iwinfo wlan0 assolist
No station connected // 没有关联的终端
root@hbg:/#
root@hbg:/# iwinfo wlan0 countrylist
00 00
AD AD
AE AE
AF AF
AG AG
AI AI
AL AL
AM AM
AN AN
AO AO
AQ AQ
AR AR
AS AS
AT AT
AU AU
AW AW
AX AX
AZ AZ
BA BA
BB BB
BD BD
BE BE
BF BF
BG BG
BH BH
BI BI
BJ BJ
BL BL
BM BM
BN BN
BO BO
BR BR
BS BS
BT BT
BV BV
BW BW
BY BY
BZ BZ
CA CA
CC CC
CD CD
CF CF
CG CG
CH CH
CI CI
CK CK
CL CL
CM CM
CN CN
CO CO
CR CR
CU CU
CV CV
CX CX
CY CY
CZ CZ
DE DE
DJ DJ
DK DK
DM DM
DO DO
DZ DZ
EC EC
EE EE
EG EG
EH EH
ER ER
ES ES
ET ET
FI FI
FJ FJ
FK FK
FM FM
FO FO
FR FR
GA GA
GB GB
GD GD
GE GE
GF GF
GG GG
GH GH
GI GI
GL GL
GM GM
GN GN
GP GP
GQ GQ
GR GR
GS GS
GT GT
GU GU
GW GW
GY GY
HK HK
HM HM
HN HN
HR HR
HT HT
HU HU
ID ID
IE IE
IL IL
IM IM
IN IN
IO IO
IQ IQ
IR IR
IS IS
IT IT
JE JE
JM JM
JO JO
JP JP
KE KE
KG KG
KH KH
KI KI
KM KM
KN KN
KP KP
KR KR
KW KW
KY KY
KZ KZ
LA LA
LB LB
LC LC
LI LI
LK LK
LR LR
LS LS
LT LT
LU LU
LV LV
LY LY
MA MA
MC MC
MD MD
ME ME
MF MF
MG MG
MH MH
MK MK
ML ML
MM MM
MN MN
MO MO
MP MP
MQ MQ
MR MR
MS MS
MT MT
MU MU
MV MV
MW MW
MX MX
MY MY
MZ MZ
NA NA
NC NC
NE NE
NF NF
NG NG
NI NI
NL NL
NO NO
NP NP
NR NR
NU NU
NZ NZ
OM OM
PA PA
PE PE
PF PF
PG PG
PH PH
PK PK
PL PL
PM PM
PN PN
PR PR
PS PS
PT PT
PW PW
PY PY
QA QA
RE RE
RO RO
RS RS
RU RU
RW RW
SA SA
SB SB
SC SC
SD SD
SE SE
SG SG
SH SH
SI SI
SJ SJ
SK SK
SL SL
SM SM
SN SN
SO SO
SR SR
ST ST
SV SV
SY SY
SZ SZ
TC TC
TD TD
TF TF
TG TG
TH TH
TJ TJ
TK TK
TL TL
TM TM
TN TN
TO TO
TR TR
TT TT
TV TV
TW TW
TZ TZ
UA UA
UG UG
UM UM
* US US // 国家代码
UY UY
UZ UZ
VA VA
VC VC
VE VE
VG VG
VI VI
VN VN
VU VU
WF WF
WS WS
YE YE
YT YT
ZA ZA
ZM ZM
ZW ZW
root@hbg:/#