溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

CentOS7命令行如何鏈接wifi

發(fā)布時(shí)間:2021-07-19 14:19:21 來源:億速云 閱讀:249 作者:小新 欄目:系統(tǒng)運(yùn)維

這篇文章主要介紹CentOS7命令行如何鏈接wifi,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

1、首先,切換到超級(jí)管理用戶 

[user@localhost]$ su root

2、檢查當(dāng)前可用的網(wǎng)卡,紅色標(biāo)記的就是網(wǎng)卡,這個(gè)并不是都是相同的 

[root@localhost]$ iw dev 

phy#0 

Interface wlp2s0 

ifindex 3 

wdev 0x1 

addr a4:db:30:84:4b:1c 

type managed 

以上是未連接網(wǎng)絡(luò)的打印信息,如果已經(jīng)連上則如下: 

[root@localhost]# iw dev 

phy#0 

Interface wlp2s0 

ifindex 3 

wdev 0x1 

addr a4:db:30:84:4b:1c 

ssid liylr 

type managed 

channel 11 (2462 MHz), width: 40 MHz, center1: 2452 MHz 

ssid就是廣播信道名稱,也就是你的無線網(wǎng)絡(luò)信號(hào),廣播信道就是最后一個(gè)

3、查看連接前的初始狀態(tài) 

[root@ localhost]# ifconfig wlp2s0 

wlp2s0: flags=4098 < BROADCAST,MULTICAST> mtu 1500 

ether 60:d8:19:cc:74:84 txqueuelen 1000 (Ethernet) 

RX packets 13547 bytes 13381624 (12.7 MiB) 

RX errors 0 dropped 0 overruns 0 frame 0 

TX packets 12659 bytes 1974514 (1.8 MiB) 

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

4、測(cè)試是否已經(jīng)鏈接網(wǎng)絡(luò) 

[root@ localhost]# iw wlp2s0 link 

Not connected.

5、獲取SSID 

[root@ localhost]# iw wlp2s0 scan | grep SSID 

command failed: Network is down (-100) 

無線網(wǎng)絡(luò)未激活,先激活。 

[root@ localhost]# ifconfig wlp2s0 up 

[root@ localhost]# ifconfig wlp2s0 

wlp2s0: flags=4099 < UP,BROADCAST,MULTICAST> mtu 1500 

ether 60:d8:19:cc:74:84 txqueuelen 1000 (Ethernet) 

RX packets 13547 bytes 13381624 (12.7 MiB) 

RX errors 0 dropped 0 overruns 0 frame 0 

TX packets 12659 bytes 1974514 (1.8 MiB) 

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

6、查看所有可用的無線網(wǎng)絡(luò)信號(hào) 

[root@localhost]# iw wlp2s0 scan | grep SSID 

SSID: USER-20150101NS_Network_2 

SSID: Tenda_17BEF8 

SSID: PC-20140723DBVC_Network_1 

SSID: 123 

SSID: Tenda_0A6410 

SSID: xiaohui 

SSID: Tenda_51E4F0 

SSID: Nobody Can 

SSID: TP-LINK_3C479

7、連接無線網(wǎng) 

[root@localhost]# wpa_supplicant -B -i wlp2s0 -c <(wpa_passphrase "Tenda_17BEF8" "useradmin") 

Successfully initialized wpa_supplicant

Tenda_17BEF8是你想鏈接的SSID,useradmin為鏈接密碼。

8、分配IP地址(通過dhclient控制網(wǎng)卡進(jìn)行網(wǎng)絡(luò)操作獲取IP) 

[root@localhost]# dhclient wlp2s0

9、最后,查看無線網(wǎng)卡地址信息,有ip地址表示網(wǎng)絡(luò)連接成功了 

[root@ localhost]# ifconfig wlp2s0 

wlp2s0: flags=4163< UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 

inet 192.168.168.139 netmask 255.255.255.0 broadcast 192.168.168.255 

inet6 fe80::62d8:19ff:fecc:7484 prefixlen 64 scopeid 0x20 

ether 60:d8:19:cc:74:84 txqueuelen 1000 (Ethernet) 

RX packets 13567 bytes 13386147 (12.7 MiB) 

RX errors 0 dropped 0 overruns 0 frame 0 

TX packets 12682 bytes 1979923 (1.8 MiB) 

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

以上是“CentOS7命令行如何鏈接wifi”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI