(1) iw dev 查看無線網卡[root@localhost 桌面]# iw devphy#0 Interface wlp4s0 ifindex 3 wdev 0x1 addr 1c:4b:d6:91:83:0a type managed(2) ip link set *** up 開啟無線網卡[root@localhost 桌面]# ip link set wlp4s0 up(3)ip link show *** 顯示無線網卡的基本信息[root@localhost 桌面]# ip link show wlp4s03: wlp4s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT qlen 1000 link/ether 1c:4b:d6:91:83:0a brd ff:ff:ff:ff:ff:ff(4) iw *** link 顯示無線網卡連接情況[root@localhost 桌面]# iw wlp4s0 linkNot connected.(5) iw *** scan|grep SSID 查看當前局域網中無線網絡SSID[root@localhost 桌面]# iw wlp4s0 scan|grep SSID SSID: TP-LINK_AA SSID: TP-202 SSID: TP-LINK_Allen SSID: Tenda_zzzz SSID: \xba\xa3\xd4\xf4\xcd\xf5\xc2\xb7\xb7\xc9 SSID: WIFI123 SSID: MERCURY_435C SSID: xiaoniu SSID: Tenda SSID: xxxxx(6)wpa_supplicant -B -i *** -c<(wpa_passphrase "SSID_XXX" "PWD_XXX") 連接無線網絡, SSID_XXX 需要連接的wifi SSID ,PWD_XXX wifi 密碼[root@localhost 桌面]# wpa_supplicant -B -i wlp4s0 -c<(wpa_passphrase "MERCURY_435C" "78787878")Successfully initialized wpa_supplicant(7) dhclient 分配IP[root@localhost 桌面]# dhclient wlp4s0[root@localhost 桌面]# ip addr show wlp4s03: wlp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether 1c:4b:d6:91:83:0a brd ff:ff:ff:ff:ff:ff inet 192.168.1.105/24 brd 192.168.1.255 scope global dynamic wlp4s0 valid_lft 172788sec preferred_lft 172788sec inet6 fe80::1e4b:d6ff:fe91:830a/64 scope link valid_lft forever preferred_lft forever連接成功測試:[root@localhost 桌面]# ping baidu.comPING baidu.com (220.181.57.217) 56(84) bytes of data.64 bytes from 220.181.57.217: icmp_seq=1 ttl=51 time=61.0 ms64 bytes from 220.181.57.217: icmp_seq=2 ttl=51 time=43.3 ms^C64 bytes from 220.181.57.217: icmp_seq=3 ttl=51 time=42.5 ms--- baidu.com ping statistics ---3 packets transmitted, 3 received, 0% packet loss, time 2000msrtt min/avg/max/mdev = 42.596/48.981/61.035/8.528 ms
http://xxxxxx/Linuxjc/1144517.html TechArticle