涉及命令
命令 |
说明 |
ifconfig eth0 up/down |
网卡的启用/禁用 |
service network restart |
重新启动网卡。如果刚插上网卡需要重启获取ip |
dhclient eth0 |
自动分配ip |
wpa_supplicant -Dwext -iwlan0 -c /etc/wpa_supplicant.conf -B |
启动wpa server |
正文
- 启动wpa_supplicant服务
wpa_supplicant -Dwext -iwlan0 -c /etc/wpa_supplicant.conf -B
- 启动wpa_cli
> scan
OK
<3>CTRL-EVENT-SCAN-RESULTS <wbr>
> scan_result
bssid / frequency / signal level / flags / ssid
6c:59:40:ec:7d:b4 <wbr> <wbr> <wbr> <wbr>2422 <wbr> <wbr>-66 <wbr> <wbr> <wbr> <wbr>[WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS] <wbr> <wbr> <wbr> <wbr>[lizhiyong](http://www.uplooking.club/)
50:fa:84:25:9b:72 <wbr> <wbr> <wbr> <wbr>2472 <wbr> <wbr>-82 <wbr> <wbr> <wbr> <wbr>[WPA-PSK-CCMP][WPA2-PSK-CCMP][ESS] <wbr> <wbr> <wbr> <wbr>\xe4\xbd\xa0\xe6\x98\xaf\xe8\x83\x86\xe5\xb0\x8f\xe9\xac\xbc
> add_net <wbr>
1
> set_net 1 ssid "lizhiyong"
OK
> set_net 1 psk "[lzylgq12345678](http://www.uplooking.club/)"
OK
> select_net 1
OK
> enable_net 1
OK
> q
- dhcpcd wlan0或dhclient wlan0
- 开机自动连接wifi
[root@linux:~] vi /etc/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
update_config=1
network={
ssid="lizhiyong"
psk="lzylgq12345678"
}
[root@linux:~] vi /etc/init.d/rcS
ifconfig wlan0 up
/usr/sbin/wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf -B
dhcpcd wlan0
[root@linux:~] chkconfig --add rcS
[root@linux:~] chkconfig rcS on
网友评论