YuzuKi X 100ask V851s 连接wifi
-
YuzuKi X 100ask V851s 连接wifi
1 ifconfig
验证是否存在 wlan0 接口(如果该命令正常执行说明驱动程序已启动并且 WiFi 固件已加载):
1.1 检查 WLAN 接口
root@TinaLinux:/# ifconfig lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) wlan0 Link encap:Ethernet HWaddr B8:15:AB:F9:9E:2A UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
1.2 初始化WLAN接口
打开wlan0
输入ifconfig就能看到有wlan0了
root@TinaLinux:/# ifconfig wlan0 up [ 426.715971] ieee80211_do_open: vif_type=2, p2p=0, ch=3, addr=b8:15:ab:f9:9e:2a [ 426.724274] [STA] !!!xradio_vif_setup: id=0, type=2, p2p=0, addr=b8:15:ab:f9:9e:2a [ 426.737749] [AP_WRN] BSS_CHANGED_ASSOC but driver is unjoined. [ 426.756330] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
2 wi
用以下命令扫描任何无线接入点的过程:
扫描可用的 SSID(AP)
仅获取 SSID 名称
root@TinaLinux:/# iw dev wlan0 scan | grep SSID SSID: ChinaNet-kRAH SSID: WiFi SSID: Programmers SSID: \xe9\xa1\xba\xe6\x88\x90\xe5\x8a\xb3\xe5\x8a\xa1 SSID: ChinaNet-LqFS SSID: HP-Print-D9-LaserJet Pro MFP SSID: SSID: ChinaNet-ffbu SSID: 1505 SSID: ChinaNet-ec7h SSID: CMCC-N2AP SSID: ChinaNet-ccXn SSID: CPE_D24FC1
3.配置连接wifi
wpa_supplicant连接WIFI的时候会从配置文件中读取账号和密码,以及加密方式等, 所以我们再运行wpa_supplicant工具的时候要提前写好配置文件。
配置文件名称自定,但是要以 .conf 为后缀,并保存在 /etc/ 目录下,这边给出一个配置文件的例子。
编辑vi /etc/wpa_supplicant.conf 文件:ctrl_interface=/var/log/wpa_supplicant update_config=1 network={ ssid="Programmers" psk="100ask****" }
创建一个socket通信的目录
mkdir -p /var/log/wpa_supplicant
4.连接到 SSID
root@TinaLinux:/# wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0 Successfully initialized wpa_supplicant
5.为 WLAN 接口分配IP地址
root@TinaLinux:/# udhcpc -i wlan0 udhcpc: started, v1.27.2 udhcpc: sending discover [ 602.197655] [TXRX_WRN] drop=1759, fctl=0x00d0. udhcpc: sending select for 192.168.0.118 udhcpc: lease of 192.168.0.118 obtained, lease time 60 udhcpc: ifconfig wlan0 192.168.0.118 netmask 255.255.255.0 broadcast 192.168.0.255 udhcpc: setting default routers: 192.168.0.1
6.检查连接性
最基本的连通性测试是使用"ping”命令。在此示例中,无线路由器(关联到)的IP地址为192.168.1.1:
root@TinaLinux:/# ping www.baidu.com PING www.baidu.com (14.215.177.39): 56 data bytes 64 bytes from 14.215.177.39: seq=0 ttl=55 time=8.874 ms 64 bytes from 14.215.177.39: seq=1 ttl=55 time=15.294 ms 64 bytes from 14.215.177.39: seq=2 ttl=55 time=40.742 ms 64 bytes from 14.215.177.39: seq=3 ttl=55 time=630.144 ms 64 bytes from 14.215.177.39: seq=4 ttl=55 time=176.153 ms 64 bytes from 14.215.177.39: seq=5 ttl=55 time=51.686 ms 64 bytes from 14.215.177.39: seq=6 ttl=55 time=17.627 ms ^C --- www.baidu.com ping statistics --- 7 packets transmitted, 7 packets received, 0% packet loss round-trip min/avg/max = 8.874/134.360/630.144 ms
注意:输入 <CTRL + C> 可终止 ping 会话。
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号