为什么我无法使用 wpa_supplicant 连接到 wifi 热点?

为什么我无法使用 wpa_supplicant 连接到 wifi 热点?

我在有移动服务的Android手机上打开了“Wi-Fi热点”,为什么我无法连接到电脑上的wifi?谢谢。

$ wpa_passphrase "moto g pure" "mypassword" | sudo wpa_supplicant -D nl80211,wext -i wlp5s0 -c 
Successfully initialized wpa_supplicant
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: Could not set interface 'p2p-dev-wlp5s0' UP
nl80211: deinit ifname=p2p-dev-wlp5s0 disabled_11b_rates=0
p2p-dev-wlp5s0: Failed to initialize driver interface
P2P: Failed to enable P2P Device interface
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=1 locally_generated=1
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Associated with xx:xx:xx:xx:xx:xx
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
WPA: No PMK set for PTK derivation
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=1 locally_generated=1
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Associated with xx:xx:xx:xx:xx:xx
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: WPA: Key negotiation completed with xx:xx:xx:xx:xx:xx [PTK=CCMP GTK=CCMP]
wlp5s0: CTRL-EVENT-CONNECTED - Connection to xx:xx:xx:xx:xx:xx completed [id=0 id_str=]
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=1 locally_generated=1
wlp5s0: No network configuration found for the current AP
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=c8:a7:0a:b0:a2:06 reason=3 locally_generated=1
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Associated with xx:xx:xx:xx:xx:xx
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: WPA: Key negotiation completed with xx:xx:xx:xx:xx:xx [PTK=CCMP GTK=CCMP]
wlp5s0: CTRL-EVENT-CONNECTED - Connection to xx:xx:xx:xx:xx:xx completed [id=0 id_str=]
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=1 locally_generated=1
wlp5s0: No network configuration found for the current AP
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=c8:a7:0a:b0:a2:06 reason=3 locally_generated=1
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Associated with xx:xx:xx:xx:xx:xx
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: WPA: Key negotiation completed with xx:xx:xx:xx:xx:xx [PTK=CCMP GTK=CCMP]
wlp5s0: CTRL-EVENT-CONNECTED - Connection to xx:xx:xx:xx:xx:xx completed [id=0 id_str=]
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=1 locally_generated=1
wlp5s0: No network configuration found for the current AP
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=c8:a7:0a:b0:a2:06 reason=3 locally_generated=1
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Associated with xx:xx:xx:xx:xx:xx
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: WPA: Key negotiation completed with xx:xx:xx:xx:xx:xx [PTK=CCMP GTK=CCMP]
wlp5s0: CTRL-EVENT-CONNECTED - Connection to xx:xx:xx:xx:xx:xx completed [id=0 id_str=]
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=1 locally_generated=1
wlp5s0: No network configuration found for the current AP
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=c8:a7:0a:b0:a2:06 reason=3 locally_generated=1
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Associated with xx:xx:xx:xx:xx:xx
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: WPA: Key negotiation completed with xx:xx:xx:xx:xx:xx [PTK=CCMP GTK=CCMP]
wlp5s0: CTRL-EVENT-CONNECTED - Connection to xx:xx:xx:xx:xx:xx completed [id=0 id_str=]
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=1 locally_generated=1
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: SME: Authentication request to the driver failed
wlp5s0: No network configuration found for the current AP
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=c8:a7:0a:b0:a2:06 reason=3 locally_generated=1
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Associated with xx:xx:xx:xx:xx:xx
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: WPA: Key negotiation completed with xx:xx:xx:xx:xx:xx [PTK=CCMP GTK=CCMP]
wlp5s0: CTRL-EVENT-CONNECTED - Connection to xx:xx:xx:xx:xx:xx completed [id=0 id_str=]
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=1 locally_generated=1
wlp5s0: No network configuration found for the current AP
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=c8:a7:0a:b0:a2:06 reason=3 locally_generated=1
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Associated with xx:xx:xx:xx:xx:xx
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: WPA: Key negotiation completed with xx:xx:xx:xx:xx:xx [PTK=CCMP GTK=CCMP]
wlp5s0: CTRL-EVENT-CONNECTED - Connection to xx:xx:xx:xx:xx:xx completed [id=0 id_str=]
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=1 locally_generated=1
wlp5s0: No network configuration found for the current AP
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=c8:a7:0a:b0:a2:06 reason=3 locally_generated=1
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Associated with xx:xx:xx:xx:xx:xx
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: WPA: Key negotiation completed with xx:xx:xx:xx:xx:xx [PTK=CCMP GTK=CCMP]
wlp5s0: CTRL-EVENT-CONNECTED - Connection to xx:xx:xx:xx:xx:xx completed [id=0 id_str=]
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=1 locally_generated=1
wlp5s0: No network configuration found for the current AP
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=c8:a7:0a:b0:a2:06 reason=3 locally_generated=1
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Associated with xx:xx:xx:xx:xx:xx
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: WPA: Key negotiation completed with xx:xx:xx:xx:xx:xx [PTK=CCMP GTK=CCMP]
wlp5s0: CTRL-EVENT-CONNECTED - Connection to xx:xx:xx:xx:xx:xx completed [id=0 id_str=]
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=1 locally_generated=1
wlp5s0: No network configuration found for the current AP
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=c8:a7:0a:b0:a2:06 reason=3 locally_generated=1
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=3 locally_generated=1
nl80211: deinit ifname=wlp5s0 disabled_11b_rates=0
wlp5s0: CTRL-EVENT-TERMINATING 

答案1

nl80211: kernel reports: Match already configured

这表明您可能有多个网络配置子系统竞争无线接口的控制权,就像 Arch 论坛上的讨论一样

如果您计划wpa_supplicant在独立模式下使用,则不应让 NetworkManager 或 netctl 等其他东西也尝试管理同一接口。或者,如果您仅使用wpa_supplicant,请确保wpa_supplicant先前尝试中的旧进程实际上已死亡,然后再启动另一个进程。

如果您使用dhcpcdDHCP 客户端(就像 Raspberry Pi OS 默认情况下那样),请注意,dhcpcd可以将其配置为自动检测网络接口并wpa_supplicant自动启动无线接口。

nl80211: Could not set interface 'p2p-dev-wlp5s0' UP
nl80211: deinit ifname=p2p-dev-wlp5s0 disabled_11b_rates=0
p2p-dev-wlp5s0: Failed to initialize driver interface
P2P: Failed to enable P2P Device interface

某些原因导致系统尝试以 p2p 模式设置接口,即两个 WiFi 客户端在没有热点/接入点的情况下直接相互通信。

wlp5s0: SME: Trying to authenticate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='moto g pure' freq=2437 MHz)
wlp5s0: Associated with xx:xx:xx:xx:xx:xx
wlp5s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wlp5s0: WPA: Key negotiation completed with xx:xx:xx:xx:xx:xx [PTK=CCMP GTK=CCMP]
wlp5s0: CTRL-EVENT-CONNECTED - Connection to xx:xx:xx:xx:xx:xx completed [id=0 id_str=]

这表明已成功建立经过身份验证的连接...

wlp5s0: CTRL-EVENT-DISCONNECTED bssid=xx:xx:xx:xx:xx:xx reason=1 locally_generated=1
wlp5s0: No network configuration found for the current AP

...但是随后,您的计算机决定自行断开连接(请注意,它说断开连接是本地生成的),显然是因为它不知道应该如何处理该连接。应该设置静态 IP 地址,还是尝试 DHCP,或者这可能应该是仅限 IPv6 的连接?

wpa_passphrase "moto g pure" "mypassword"会生成一个最小wpa_supplicant.conf片段,定义网络 SSID 及其 WPA 密码。但尝试将其输出通过管道传输可能wpa_supplicant -c行不通,因为该选项-c需要一个配置文件的路径名

Arch wiki 中建议的命令格式有些不同。尝试停止任何现有的wpa_supplicantdhcpcdNetworkManager/或netctl进程,然后运行:

sudo wpa_supplicant -D nl80211,wext -i wlp5s0 -c <(wpa_passphrase "moto g pure" "mypassword")

该语法根据所包含命令的输出创建一个临时文件,并在执行主命令之前<( ... )用临时文件的名称代替命令行上的构造。<( ... )

相关内容