使用命令:iwconfig ath1 essid "ap_test" key 12345678
报错:Error for wireless request "Set Encode" (8B2A) :
SET failed on device wlan0 ; Invalid argument.
用户和密码都没错,这是什么原因呢?
我们使用iwlist ath1 scanning 扫描ap_test的信息:
Cell 10 - Address: 54:B1:21:ED:75:E8
ESSID:"ap_test"
Mode:Master
Frequency:5.765 GHz (Channel 153)
Quality=88/94 Signal level=-61 dBm Noise level=-95 dBm
Encryption key:on
Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s
36 Mb/s; 48 Mb/s; 54 Mb/s
Extra:bcn_int=100
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
Extra:wme_ie=dd180050f2020101000003a4000027a4000042435e0062322f00
认证方式是WPA2,iwconfig不支持这种认证方式,因此连不上。iwconfig方式只能连接无密码的AP。
正确姿势是使用wpa_supplicant连接。