1

I'd like to know if it's possible -- I hope and guess it is -- to switch between different networks in wpa_cli without using select_network, as this disables all other networks.

Thing is, say I have n networks to connect to and stored in my wpa_supplicant.conf. For whatever reason, I want to switch from network 1 to 2. Right now I'm using select_network, which disables all the other networks 1, 3, ..., n. This means that if network 2 crashes for some reason, wpa_supplicant won't automatically connect to a different available network. I'd like to avoid that by finding a method to switch between networks without using select_network. Any idea how to do that?

5
  • "select_network any" isn't quite what you want - but this is a good question.
    – user732
    May 6, 2019 at 16:31
  • First thing I'd try is to write a script using wpa_cli that changes the priorities of the configured networks, and gives the one you want to connect to the highest priority, and see if this already gets wpa_supplicant to switch.
    – dirkt
    May 7, 2019 at 6:10
  • changing priorities followed by a reassociate seems to do what i want. thanks @dirkt
    – plazmakeks
    May 7, 2019 at 7:13
  • For the next person with the same problem, please write an answer with details about what you did. You can accept your own answer.
    – dirkt
    May 7, 2019 at 7:15
  • Something else that may be relevant to you (or others finding this question) is nmcli - It's what worked for me to manually switch between available networks (wpa_cli was only showing one in list_networks, even after a scan produced scan_results showing various others -- so I couldn't figure out how to switch with wpa_cli, but nmcli con up <networkname> worked for me.)
    – lindes
    Jan 19, 2023 at 17:40

2 Answers 2

2

One can change the priorities of each network with set_network <networdId> priority <priority> and perform a reassociate afterwards.

0

From http://w1.fi/wpa_supplicant/devel/ctrl_iface_page.html:

SELECT_NETWORK Select a network (disable others). Network id can be received from the LIST_NETWORKS command output.

ENABLE_NETWORK Enable a network. Network id can be received from the LIST_NETWORKS command output. Special network id all can be used to enable all network.

From this I understood that once a network is selected, the others are disabled (conf file changed with disabled 1 for all other networks). So I send the command: ENABLE_NETWORK all after connecting to a specific network.

If for some reason the network that the device is connected to becomes unavailable, the WPA automatically connects the device to one of the other "known" networks.

And it works!!!!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .