Network-Interface

無線網路介面不會出現

  • July 30, 2021

我的設備(OS Ubuntu 20.04)的無線連接不會啟動。

  • 這是之前的狀態
$ ip a sh dev wlp1s0

4: wlp1s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
   link/ether b8:b7:f1:c0:4a:05 brd ff:ff:ff:ff:ff:ff
  • 然後我提出來
$ sudo ifconfig wlp1s0 up
  • 當我再次檢查時,沒有任何改變……
$ ip a sh dev wlp1s0

4: wlp1s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
   link/ether b8:b7:f1:c0:4a:05 brd ff:ff:ff:ff:ff:ff
  • 這是網路計劃配置:
$ cat /etc/netplan/01-wifi.yaml

renderer: networkd
ethernets:
    enp1s0:
        dhcp4: true
    enp2s0:
        dhcp4: true
version: 2
wifis:
    wlp1s0:
        optional: true
        access-points:
            "abc":
                password: "xyz"
        dhcp4: true
  • 這是來自的回應ifconfig
enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       inet 10.111.140.246  netmask 255.255.255.0  broadcast 10.111.140.255
       inet6 fe80::4e38:d5ff:fe11:746e  prefixlen 64  scopeid 0x20<link>
       ether 4c:38:d5:11:74:6e  txqueuelen 1000  (Ethernet)
       RX packets 109968  bytes 126944297 (126.9 MB)
       RX errors 0  dropped 4233  overruns 0  frame 0
       TX packets 61725  bytes 8701147 (8.7 MB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
       inet 127.0.0.1  netmask 255.0.0.0
       inet6 ::1  prefixlen 128  scopeid 0x10<host>
       loop  txqueuelen 1000  (Local Loopback)
       RX packets 234239  bytes 26630063 (26.6 MB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 234239  bytes 26630063 (26.6 MB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp1s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
       ether b8:b7:f1:c0:4a:05  txqueuelen 1000  (Ethernet)
       RX packets 0  bytes 0 (0.0 B)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 0  bytes 0 (0.0 B)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

如何連接wifi?

的輸出ifconfig清楚地表明wlp1s0存在up。如果sudo ifconfig wlp1s0 up失敗,您將被通知無法引發此特定介面。ifconfig [dev] up在提升特定介面後,它本身不負責建立連接。

  1. 您需要確保已wpa-supplicant安裝以便使用 WPA2 進行身份驗證。你可以通過sudo apt install wpa-supplicant
  2. 該文件01-wifi.yaml不是有效的配置文件。為了實現此配置,您需要執行文件sudo netplan generate中的設置,*.yaml以便為選定的渲染器重新生成,即networkd在您的情況下。
  3. 最後,在生成配置後,您需要使用sudo netplan apply

引用自:https://unix.stackexchange.com/questions/662497