本文转载自:
本文是在正确安装好wifi驱动后对系统进行的配置。
1. 配置wpa_supplicant的配置文件
在加载驱动之前在/etc下新建目录/wpa_supplicant/wpa_supplicant.conf
配置好需要的wifi的ssid及psk即可
具体配置如下 :
#vi wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
update_config=1
eapol_version=1
fast_reauth=1
network={
ssid="wifi名称"
psk="密码"
priority=1
}
2.加载驱动: insmod /lib/modules/3.4.39/8723au.ko
3.启动wifi:
# ifconfig 获取wifi名称 一般是wlan0
# ifconfig wlan0 up
4.后台运行wpa_supplicant:
wpa_supplicant-d -Dnl80211 -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf &
其中 :
wpa_supplicant:可执行程序
–d :增加打印信息
-Dnl80211: 驱动名称
-iwlan0:wlan0,网络接口名称
/etc/wpa_supplicant/wpa_supplicant.conf:wpa_supplicant的配置文件path
5. 为wlan0动态分配ip地址:udhcpc -iwlan0
打印如下: udhcpc (v1.18.3)started
Sending discover...
Sending select for 192.168.1.110...
Lease of 192.168.1.110 obtained, lease time 7200
deleting routers
route: SIOCDELRT: No such process
adding dns 192.168.14.12
adding dns 192.168.1.1
6. 查看wlan0状态:# ifconfig
打印如下:
wlan0 Link encap:Ethernet HWaddr CC:D2:9B:6E:6C:00
inet addr:192.168.1.110 Bcast:255.255.255.255 Mask:255.255.255.0 inet6 addr: fe80::ced2:9bff:fe6e:6c00/64Scope:Link
UP BROADCAST RUNNINGMULTICAST MTU:1500 Metric:1
RX packets:242 errors:0dropped:1 overruns:0 frame:0
TX packets:25 errors:0 dropped:2overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:36120 (35.2KiB) TX bytes:3851 (3.7 KiB)
7. ping 网络
# ping www.baidu.com
PING www.baidu.com (112.80.248.73): 56 data bytes
64 bytes from 112.80.248.73: seq=0 ttl=50 time=104.026 ms
64 bytes from 112.80.248.73: seq=1 ttl=50 time=190.992 ms
64 bytes from 112.80.248.73: seq=2 ttl=50 time=316.463 ms
64 bytes from 112.80.248.73: seq=3 ttl=50 time=135.019 ms
64 bytes from 112.80.248.73: seq=4 ttl=50 time=156.059 ms
64 bytes from 112.80.248.73: seq=5 ttl=50 time=79.399 ms
64 bytes from 112.80.248.73: seq=6 ttl=50 time=100.952 ms
64 bytes from 112.80.248.73: seq=7 ttl=50 time=255.441 ms
64 bytes from 112.80.248.73: seq=8 ttl=50 time=143.440 ms
64 bytesfrom 112.80.248.73: seq=9 ttl=50 time=64.766 ms
- 顶
- 0
- 踩