1

I am failing to connect to open wifi networks using wpa_cli. I am trying to connect to the open wifi networks in the following way:

$ sudo wpa_cli -i wlp3s0
> add_network
0
> set_network 0 ssid "Guest"
> enable_network 0

When I try to enable the network sometimes it just replies OK and then nothing. Few times, I have seen it to reply following:

<3>CTRL-EVENT-SCAN-STARTED
<3>CTRL-EVENT-SCAN-RESULTS
<3>WPS-AP-AVAILABLE
<3>CTRL-EVENT-NETWORK-NOT-FOUND

wpa_cli is working without any issue for password protected networks.

0
2

Usually to connect to a network requires to use some authentication mechanism. This is handled among other settings by wpa_supplicant's key_mgmt variable:

# 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

Connecting to an open SSID means not using any authentication nor cipher: the parameter has to be changed from default to NONE as written above (plaintext case).

This value can be set dynamically through the wpa_cli command before enabling (the use) of the network as many other values:

> help set_network
commands:
  set_network <network id> <variable> <value> = set network variables (shows
    list of variables when run without arguments)

This command should be inserted before enable_network:

set_network 0 key_mgmt NONE

An example run could look like this:

# 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
[...]
1
  • I was expecting some kind of key management. Didn't know how to do it. help command in the interactive mode or man wpa_cli didn't help. Thank you so much. It is working now. Aug 18 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.