wpa_supplicant.conf设置如下
# cat /etc/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant GROUP=wheel
network={
ssid="TP-LINK_413"
#psk=""
psk=e69abb9b46dcbf8df67738a2eda466c54b3f12043e54157d58e097c3e19fa2e3
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
}
连接wifi:
# wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf -dd -B
结果如下:
查看wifi信息
# iwconfig
结果如下:
至此wifi连接完毕,附上一张路由上的主机列表,划线的就是ubuntu,不过收包、发包太少了
设置网卡IP:
# cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
# auto eth0
# iface eth0 inet static
auto wlan0
iface wlan0 inet static
address 192.168.1.192
netmask 255.255.255.0
# home
gateway 192.168.1.253
# work
# gateway 192.168.1.1
network 192.168.1.253
设置DNS
# cat /etc/resolv.conf
nameserver 192.168.1.253
nameserver 8.8.8.8
重新启动网络服务
# service networking restart
结果如下:
启动wlan0:
# ifconfig wlan0 up
# ifconfig
结果如下:
ping网关
# vi /etc/resolv.conf
root@cubieboard-server:~# ping -c 4 192.168.1.253
PING 192.168.1.253 (192.168.1.253) 56(84) bytes of data.
64 bytes from 192.168.1.253: icmp_req=1 ttl=64 time=1.90 ms
64 bytes from 192.168.1.253: icmp_req=2 ttl=64 time=1.59 ms
64 bytes from 192.168.1.253: icmp_req=3 ttl=64 time=1.99 ms
64 bytes from 192.168.1.253: icmp_req=4 ttl=64 time=1.60 ms
--- 192.168.1.253 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 1.597/1.776/1.999/0.178 ms
ping 外网,失败了
# ping -c 4 baidu.com
PING baidu.com (123.125.114.144) 56(84) bytes of data.
rtw_set_ps_mode: Leave 802.11 power save
rtl8188e_set_FwPwrMode_cmd: Mode=0 SmartPS=2 UAPSD=0
rtw_set_ps_mode: Enter 802.11 power save
rtl8188e_set_FwPwrMode_cmd: Mode=1 SmartPS=2 UAPSD=0
--- baidu.com ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3008ms
查看route
不需要解决,已经连续成功啦(
CONNECTED
)。加-B
选项它才会自动 fork 到后台去。现在你可以用
dhcpcd
或者dhclient
程序来获取动态 IP 地址了,然后就可以上网了。