fq关联无线网络,不同的无线网络认证方式不同设置:
1)open(开放式认证方式,分为):
wpa_cli -iwlan0 set_network 0 ssid ‘"wlan"‘(PS:wlan是无线的ssid号,外面是一对双引号,然后再外面是一对单引号)
wpa_cli -iwlan0 set_network 0 key_mgmt NONE
2)wep(分为开放式和共享式):
wpa_cli -iwlan0 set_network 0 ssid ‘"wlan"‘
wpa_cli -iwlan0 set_network 0 key_mgmt NONE
wpa_cli -iwlan0 set_network 0 wep_key0 ‘"wlan_key"‘
如果是共享式,还需要配置:wpa_cli -iwlan0 set_network 0 auth_alg SHARED(默认是开放式,可以不配置)
3)WPA/WPA2-Personal认证方式:
wpa_cli -iwlan0 set_network 0 ssid ‘"wlan"‘
wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK
wpa_cli -iwlan0 set_network 0 proto WPA(WPA2)
wpa_cli -iwlan0 set_network 0 pairwise TKIP(CCMP)
wpa_cli -iwlan0 set_network 0 group TKIP(CCMP)
wpa_cli -iwlan0 set_network 0 psk ‘"wlan_password"‘
4)WPA/WPA2-Enterprise认证方式:
wpa_cli -iwlan0 set_network 0 ssid ‘"wlan"‘
wpa_cli -iwlan0 set_network 0 key_mgmt WPA-EAP
wpa_cli -iwlan0 set_network 0 pairwise TKIP(CCMP)
wpa_cli -iwlan0 set_network 0 group TKIP(CCMP)
wpa_cli -iwlan0 set_network 0 eap PEAP
wpa_cli -iwlan0 set_network 0 identity ‘"username"‘
wpa_cli -iwlan0 set_network 0 password ‘"password"‘
如果是WPA2-Enterprise认证:需要设置proto:wpa_cli -iwlan0 set_network 0 protoWPA2
然后开始关联:wpa_cli -iwlan0 enable_network 0
如果dhcp获取ip地址,需要等关联上之后去dhcp;查看关联状态wpa_cli -iwlan0 status
如果状态是complete的话:dhcp wlan0
一般操作过程是,先查看无线网络,是否要关联的无线网络可见:
wpa_cli -iwlan0 scan
wpa_cli -iwlan0 scan_results
如果可见,则如上配置network 0,然后关联:
wpa_cli -iwlan0 enable_network 0
wpa_cli -iwlan0 status如果关联上,dhcp wlan0
之后如果解关联,需要先释放IP,然后up端口,然后解关联:
dhcp -r wlan0
(需要等待一会,等待release完ip)
然后ifconfig wlan0 up
最后wpa_cli -iwlan0 disable_network 0
4. udhcpc -i wlan0 //
route add default gw 192.168.43.1 //修改网关
---------------------
作者:shexujia
来源:CSDN
原文:https://blog.csdn.net/shexujia/article/details/18302007
版权声明:本文为博主原创文章,转载请附上博文链接!
原文地址:https://www.cnblogs.com/henryliublog/p/9944329.html