Wifi

NetworkManager 添加連接但不設置介面

  • November 8, 2019

我執行以下命令來添加到網路管理器的新連接:

nmcli con add con-name MIDVERCORP ifname wlan0 type wifi ssid "MIDVERCORP"

當我查看我配置的連接時,這個新連接已添加,但介面/設備未設置為wlan0.

# nmcli con
NAME                UUID                                  TYPE      DEVICE
eth0                1c71a54a-5ef1-4e32-ad02-8427f0168645  ethernet  eth0
eth1                57ce5d30-cde3-4b07-b83f-a5935f93cb6a  ethernet  eth1
MIDVERCORP          48e53a8a-ccbb-461e-bdca-74a837aa2c98  wifi      --
Wired connection 1  0eabbb3d-40d4-3031-a46e-14d87f9ac275  ethernet  --
Wired connection 2  fc12cba9-ee87-377d-ac4e-746a2f8fd6b3  ethernet  --
static-usb0         f93578c1-d309-4103-8554-fc1982ccda02  ethernet  --
# ip link show wlan0
5: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000
   link/ether c0:ee:40:50:25:c0 brd ff:ff:ff:ff:ff:ff

為此連接設置 wlan0 介面我缺少什麼?

編輯

要進一步顯示 wifi 已啟用:

# nm radio wifi on
# nm radio
WIFI-HW  WIFI     WWAN-HW  WWAN
enabled  enabled  enabled  enabled
# nm dev wifi rescan
Error: Scanning not allowed while unavailable or activating.
# ip link show wlan0
6: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000
   link/ether c0:ee:40:50:25:c0 brd ff:ff:ff:ff:ff:ff
# ip addr show wlan0
6: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
   link/ether c0:ee:40:50:25:c0 brd ff:ff:ff:ff:ff:ff

我的問題是 wpa_supplicant 沒有執行。

systemctl start wpa_supplicant

然後我可以執行nmcli dev wifi rescan; nmcli dev wifi list並查看可用的 AP。

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