WPA CLI
来自Ubuntu中文
跳到导航跳到搜索
终端手动连接 Wifi。
检查无线网卡信息
qii@ubuntu:~$ iwconfig wlan0 wlan0 IEEE 802.11bgn ESSID:"Ubuntu-wiki-wpa-cli" Mode:Managed Frequency:2.412 GHz Access Point: D3:1D:3C:11:A2:A1 Bit Rate=11 Mb/s Tx-Power=20 dBm Retry long limit:7 RTS thr:off Fragment thr:off Power Management:on Link Quality=58/70 Signal level=-52 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0
重启无线网卡
sudo ifconfig wlan0 down sudo ifconfig wlan0 up
搜索接入点
sudo iwlist wlan0 scanning
返回接入点列表,类似这样的
wlan0 Scan completed : Cell 01 - Address: D4:3D:1C:53:A3:A4 Channel:1 Frequency:2.412 GHz (Channel 1) Quality=54/70 Signal level=-56 dBm Encryption key:on ESSID:"Ubuntu-wiki-wpa-cli" Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s Mode:Master Extra:tsf=0000002d049a7181 Extra: Last beacon: 232ms ago IE: Unknown: 000954506C2D4D61676963 IE: Unknown: 010482848B96 IE: Unknown: 030101 IE: IEEE 802.11i/WPA2 Version 1 Group Cipher : CCMP Pairwise Ciphers (1) : CCMP Authentication Suites (1) : PSK Preauthentication Supported IE: WPA Version 1 Group Cipher : CCMP Pairwise Ciphers (1) : CCMP Authentication Suites (1) : PSK
注意这一行,这行就是接入点的 ESSID
ESSID:"Ubuntu-wiki-wpa-cli"
设定要连接的接入点,替换下列的ESSID
sudo iwconfig wlan0 essid ESSID
密码
sudo iwconfig wlan0 key s:密码
警告: 密码最好由字母和数字组成,你要是设的密码有!/#%$^#这类字符,这里会逼疯你的,这些特定字符会被Bash直接处理而不当作参数,出现bash: !~'": event not found 或 Error for wireless request "Set Encode" (8B2A) :
invalid argument ,试试加“”或' ',如果还不行,自己看着办吧。
,
然后是自动获取 IP
sudo dhclient wlan0