此方式 可以通过串口来操作
1.进入wpa_cli后,命令如下:
# wpa_cli
# scan
# scan_results
;会显示搜索到的wifi信号列表,假设你的wifi ssid是wireless0
# add_net 会打印一个net编号,如果打印0
0
# set_network 0 ssid "wireless0" //wifi名称
# set_network 0 psk "123456" //123456是wireless0的密码。
# select_network 0
# enable_network 0
# quit //执行q就会退出wpa_cli
2.查看wifi是否连接成功
# ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 90:bd:e6:36:6a:d6
inet addr:192.168.0.112 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::92bd:e6ff:fe36:6ad6/64 Scope: Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:699 errors:0 dropped:0 overruns:0 frame:0
TX packets:654 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:757221 TX bytes:75376
注意ÿ