我正在尝试在 Ubuntu Server 上运行 USB Wi-Fi 加密狗。我编辑/etc/netplan/*.yaml
并运行了多个网络接口,它们都按预期工作。请参阅下面的几行以了解 Wi-Fi 设置。渲染器是NetworkManager
。
wifis:
wlan0:
access-points:
"SSID":
password: "********"
dhcp4: true
optional: true
我能够看到wlan0
界面并扫描:
wlan0 Scan completed :
Cell 01 - Address: 1C:43:63:26:2C:DC
Channel:9
Frequency:2.452 GHz (Channel 9)
Quality=42/70 Signal level=-68 dBm
Encryption key:on
ESSID:"SSID"
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s
Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
Mode:Master
Extra:tsf=0000000e5148e399
Extra: Last beacon: 72ms ago
日志来自NetworkManager
:
Nov 27 17:21:43 sp4k001 NetworkManager[2312]: <info> [1669569703.6108] device (wlan0): supplicant interface state: starting -> ready
Nov 27 17:21:43 sp4k001 NetworkManager[2312]: <info> [1669569703.6111] Wi-Fi P2P device controlled by interface wlan0 created
Nov 27 17:21:43 sp4k001 NetworkManager[2312]: <info> [1669569703.6117] manager: (p2p-dev-wlan0): new 802.11 Wi-Fi P2P device (/org/freedesktop/NetworkManager/Devices/5)
Nov 27 17:21:43 sp4k001 NetworkManager[2312]: <info> [1669569703.6125] device (p2p-dev-wlan0): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'external')
Nov 27 17:21:43 sp4k001 NetworkManager[2312]: <warn> [1669569703.6141] sup-iface: failed to cancel p2p connect: P2P cancel failed
Nov 27 17:21:43 sp4k001 NetworkManager[2312]: <info> [1669569703.6142] device (p2p-dev-wlan0): state change: unavailable -> disconnected (reason 'none', sys-iface-state: 'managed')
Nov 27 17:21:43 sp4k001 NetworkManager[2312]: <info> [1669569703.6147] device (wlan0): state change: unavailable -> disconnected (reason 'supplicant-available', sys-iface-state: 'managed')
有什么想法吗?我尝试过有和没有,但 Netplan.io 说运行后端时wpa_supplicant
不需要。wpa_supplicant
NetworkManager
我还发现了以下日志netplan-wpa-wlan0.service
:
Nov 27 16:18:53 sp4k001 wpa_supplicant[3908]: wlan0: SME: Trying to authenticate with 1c:43:63:26:2c:dc (SSID='Hairy-Lemon' freq=2452 MHz)
Nov 27 16:18:53 sp4k001 wpa_supplicant[3908]: wlan0: Trying to associate with 1c:43:63:26:2c:dc (SSID='Hairy-Lemon' freq=2452 MHz)
Nov 27 16:18:53 sp4k001 wpa_supplicant[3908]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="Hairy-Lemon" auth_failures=7 duration=90 reason=CONN_FAILED
Nov 27 16:20:24 sp4k001 wpa_supplicant[3908]: wlan0: CTRL-EVENT-SSID-REENABLED id=0 ssid="Hairy-Lemon"
Nov 27 16:20:24 sp4k001 wpa_supplicant[3908]: wlan0: SME: Trying to authenticate with 1c:43:63:26:2c:dc (SSID='Hairy-Lemon' freq=2452 MHz)
Nov 27 16:20:24 sp4k001 wpa_supplicant[3908]: wlan0: Trying to associate with 1c:43:63:26:2c:dc (SSID='Hairy-Lemon' freq=2452 MHz)
Nov 27 16:20:25 sp4k001 wpa_supplicant[3908]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="Hairy-Lemon" auth_failures=8 duration=90 reason=CONN_FAILED
当我运行 时nmcli dev wifi connect SSID password ******
,一切正常。我是否无法使用netplan
而不NetworkManager
依赖wpa_supplicant
?任何帮助都值得感激,这似乎是 Ubuntu Server 上很多人的常见问题。
需要澄清的是,这个问题不能通过以下步骤解决:发布升级后 IntelNUC 没有 WiFi
开箱即用,我无法设置 netplan 并使用 PSK 将 Wi-Fi 连接到 AP。请参阅上面的错误消息。
答案1
这并没有回答你的问题,但 NetworkManager 确实依赖 wpasupplicant 进行 WiFi 身份验证。唯一的区别是,如果你安装了 NetworkManager,它就会被拉进来自动地。如果您使用networkd,那么您需要手动安装它。
这些日志看起来就像是一个错误的 wifi 密码。您可以检查以下内容,/run/NetworkManager
以确保 netplan 发出的文件具有正确的密码,并且您没有被某些 yaml 转义问题所困扰。
答案2
抱歉再次提起这件事,这是驱动程序问题,因为 wpasupplicant 将信息传递给 Ubuntu 不熟悉的 rtl82xxx 驱动程序。我使用的是 TP-Link Mini N300 USB 适配器,这是导致这种奇怪行为的原因。Edimax EW-7811 似乎可以与 Ubuntu 中的 rtl8192cu 芯片配合使用,并运行 Netplan。
使用 NetworkManager 渲染器正常运行 Netplan,安装 wpasupplicant 后运行良好。只需确保您的设备和服务不冲突即可。