(1) iw dev 查看无线网卡 [root@localhost 桌面]# iw dev phy#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 wlp4s0 3: 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 link Not 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 wlp4s0 3: 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.com PING 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 ms 64 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 2000ms rtt min/avg/max/mdev = 42.596/48.981/61.035/8.528 ms (责任编辑:IT) |