我无法使用 wpa_cli 连接到开放的 wifi 网络。我正在尝试通过以下方式连接到开放的 wifi 网络:
$ sudo wpa_cli -i wlp3s0
> add_network
0
> set_network 0 ssid "Guest"
> enable_network 0
当我尝试启用网络时,有时它只是回复“正常”,然后什么也没回复。有几次,我看到它的回复如下:
<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-RESULTS
<3>WPS-AP-AVAILABLE
<3>CTRL-EVENT-NETWORK-NOT-FOUND
wpa_cli 对于密码保护的网络来说没有任何问题。
答案1
通常连接到网络需要使用某种身份验证机制。这是由 wpa_supplicant 的其他设置处理的key_mgmt
多变的:
# key_mgmt: list of accepted authenticated key management protocols # WPA-PSK = WPA pre-shared key (this requires 'psk' field) # WPA-EAP = WPA using EAP authentication # IEEE8021X = IEEE 802.1X using EAP authentication and (optionally) dynamically # generated WEP keys # NONE = WPA is not used; plaintext or static WEP could be used [...] # If not set, this defaults to: WPA-PSK WPA-EAP
连接到打开SSID 意味着不使用任何身份验证或密码:该参数必须从默认值更改为NONE
上面写的(纯文本案件)。
wpa_cli
该值可以在启用(使用)网络之前通过命令动态设置,就像许多其他值一样:
> help set_network
commands:
set_network <network id> <variable> <value> = set network variables (shows
list of variables when run without arguments)
该命令应插入之前enable_network
:
set_network 0 key_mgmt NONE
运行示例可能如下所示:
# wpa_cli -i wlp3s0
wpa_cli v2.9
[...]
Interactive mode
> add_network
0
> set_network 0 ssid "Guest"
> set_network 0 key_mgmt NONE
> enable_network 0
OK
<3>SME: Trying to authenticate with 12:34:56:78:9a:bc (SSID='Guest' freq=2437 MHz)
<3>Trying to associate with 12:34:56:78:9a:bc (SSID='Guest' freq=2437 MHz)
<3>Associated with 12:34:56:78:9a:bc
<3>CTRL-EVENT-CONNECTED - Connection to 12:34:56:78:9a:bc completed [id=0 id_str=]
<3>CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
[...]