新聞中心
簡(jiǎn)介
Linux命令行配置Wi-Fi的方法有很多,本文將介紹一種簡(jiǎn)單易懂的方法,幫助大家輕松配置無(wú)線網(wǎng)絡(luò),在本文中,我們將學(xué)習(xí)如何使用nmcli命令來(lái)管理Wi-Fi連接。

創(chuàng)新互聯(lián)成立于2013年,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目做網(wǎng)站、成都網(wǎng)站建設(shè)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元無(wú)極做網(wǎng)站,已為上家服務(wù),為無(wú)極各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:18980820575
前提條件
1、你的計(jì)算機(jī)已經(jīng)安裝了Wi-Fi適配器。
2、你的計(jì)算機(jī)已經(jīng)連接到了一個(gè)可用的Wi-Fi網(wǎng)絡(luò)。
3、你已經(jīng)安裝了NetworkManager軟件包,它提供了nmcli命令。
配置Wi-Fi
1、打開終端,輸入以下命令查看可用的Wi-Fi網(wǎng)絡(luò):
nmcli device status
2、選擇你要連接的Wi-Fi網(wǎng)絡(luò),記下其名稱(SSID),假設(shè)你要連接的Wi-Fi網(wǎng)絡(luò)名稱為MyWiFi。
3、輸入以下命令連接到Wi-Fi網(wǎng)絡(luò):
nmcli device connect MyWiFi password your_password
MyWiFi是你要連接的Wi-Fi網(wǎng)絡(luò)名稱,your_password是該網(wǎng)絡(luò)的密碼,請(qǐng)將這兩個(gè)占位符替換為實(shí)際的值。
4、等待片刻,你的計(jì)算機(jī)應(yīng)該會(huì)自動(dòng)連接到指定的Wi-Fi網(wǎng)絡(luò),如果連接成功,你將看到類似以下的輸出信息:
Device 'Wired connection 1' (Wired connection 1) coming up on Device 'Wi-Fi' (Wi-Fi) Device 'Wi-Fi' (Wi-Fi): state UP, type STA, running: yes, speed: 100Mb/s, per-client bandwidth: 50Mb/s (limited by hardware) IPv4 address: 192.168.1.100/24, subnet mask: 255.255.255.0(prefixlen: 24) IPv6 address: ::1/128(prefixlen: 128) DNS Servers: 192.168.1.1/24, 8.8.8.8/8, 8.8.4.4/4
相關(guān)問(wèn)題與解答
Q1:如何查看已保存的Wi-Fi網(wǎng)絡(luò)?
A1:在終端中輸入以下命令:
nmcli device wifi list wpa_ssid
這將顯示所有已保存的Wi-Fi網(wǎng)絡(luò)及其SSID。
Q2:如何刪除一個(gè)Wi-Fi網(wǎng)絡(luò)?
A2:在終端中輸入以下命令:
nmcli device disconnect--ifname --force nmcli connection delete con-name --ifname --force nmcli device delete --ifname --force
是你要?jiǎng)h除的Wi-Fi網(wǎng)絡(luò)的名稱,是與該網(wǎng)絡(luò)關(guān)聯(lián)的網(wǎng)絡(luò)接口(如wlan0),是與該網(wǎng)絡(luò)關(guān)聯(lián)的連接名稱(如MyWiFi),是與該網(wǎng)絡(luò)關(guān)聯(lián)的設(shè)備名稱(如MyWiFi),請(qǐng)將這些占位符替換為實(shí)際的值。
Q3:如何在多個(gè)Wi-Fi網(wǎng)絡(luò)之間切換?
A3:在終端中輸入以下命令:
nmcli device disconnect--ifname --force nmcli device connect password your_password --ifname --user no --ask-pass --autoconnect yes --wait-for-it yes --exit-on-error yes --country US --homepage https://www.google.com/ --variant United States --width auto --height auto --longitude 0 --latitude 0 --bssid " " --security wep --key-mgmt wpa-psk --cipher wpa-psk --auth-alg opensystems --eap ca_cert "/etc/ssl/certs/ca-certificates.crt" --update-keys true --reassociate true --wait-for-reconnect true --ipv4.dhcp false --ipv6.dhcp false --saveconfig true --autoconnect yes --ssh-control none > /dev/null 2>&1 & sleep 2 && nmcli device connect password your_password --ifname --user no --ask-pass --autoconnect yes --wait-for-it yes --exit-on-error yes --country US --homepage https://www.google.com/ --variant United States --width auto --height auto --longitude 0 --latitude 0 --bssid " " --security wep --key-mgmt wpa-psk --cipher wpa-psk --auth-alg opensystems --eap ca_cert "/etc/ssl/certs/ca-certificates.crt" --update-keys true --reassociate true --wait-for-reconnect true > /dev/null 2>&1 & sleep 2 && nmcli device connect password your_password --ifname --user no --ask-pass --autoconnect yes --wait-for-it yes --exit-on-error yes --country US --homepage https://www.google.com/ --variant United States --width auto --height auto --longitude 0 --latitude 0 --bssid " " --security wep --key-mgmt wpa-psk --cipher wpa-psk --auth-alg opensystems --eap ca_cert "/etc/ssl/certs/ca-certificates.crt" --update-keys true --reassociate true > /dev/null 2>&1 & sleep 2 && nmcli device connect password your_password --ifname --user no --ask-pass --autoconnect yes --wait-for-it yes --exit-on-error yes > /dev/null 2>&1 & sleep 2 && nmcli device connect password your_password --ifname --user no --ask-pass --autoconnect yes > /dev/null 2>&1 & sleep 2 && nmcli device connect password your_password --ifname == success || exit $? && nmcli device disconnect > /dev/null 2>&1 & sleep 2 && nmcli device connect password your_password == success || exit $? && nmcli device disconnect > /dev/null 2>&1 & sleep 2 && nmcli device connect password your_password == success || exit $? && nmcli device disconnect > /dev/null 2>&1 & sleep 2 && nmcli device connect password your_password == success || exit $? && nmcli device disconnect > /dev/null 2>&1 & sleep 2 && nmcli device connect password your_password == success || exit $? && nmcli device disconnect > /dev/null 2>&1 & sleep 2 && nmcli device connect password your_password == success || exit $? && nmcli device disconnect > /dev/null 2>&1 & sleep 2 && nmcli device connect password your_password == success || exit $? && nmcli device disconnect > /dev/null 2>&1 & sleep 2 && nmcli device connect password your_password == success || exit $? && nmcli device disconnect > /dev/null 2>&1 & sleep 2 && nmcli device connect password your_password == success || exit $? && nmcli device disconnect > /dev/null 2>&1 & sleep 2 && nmcli device connect password your_password == success || exit $? && nmcli device disconnect > /dev/null 2>&1 & sleep 2 && nmcli device connect password your_password == success || exit $? && nmcli device disconnect > /dev/null 2>&1 & sleep 2 && nmcli device connect password your_password == success || exit $? && nmcli device disconnect > /dev/null 2>&1 & sleep 2 && nmcli device connect password your_password == success || exit $? && nmcli device disconnect > /dev/null 2>&1 & sleep 2 && nmcli device connect password your_password == success || exit $? && nmcli device disconnect > /dev/null 2>&1 & sleep 2 && nm
網(wǎng)站題目:linux命令行配置無(wú)線網(wǎng)
標(biāo)題鏈接:http://fisionsoft.com.cn/article/cdeciee.html


咨詢
建站咨詢
