You are not logged in.
Hi everyone,
I have been using wpa_supplicant for a long time on arch. I can connect to 2 different networks at home, both are configured in my wpa_supplicant-wlp.conf file.
I can not find a command to change/switch from one network to another.
For example, when I am connected to my SSID_2.4Ghz network I would like a command to disconnect and then connect to my SSID_5Ghz (or the opposite).
Does someone know a way to do that through wpa_(supplicant/cli)?
Thanks for your time.
Last edited by Yann (2019-03-16 12:04:46)
all different - all equal
Offline
Yann, within the `wpa_cli` tool, you can use `disable <id>` to stop association between you and network <id>. Conversely, you can use `enable <id>` to enable a network that may be disabled or temp-disabled in the past (or one with no state).
Association to enabled networks will be automatically attempted by wpa_supplicant.
In short:
disable <id_of_current_network>
enable <id_of_new_network>
Will do what you want. You could write shell scripts that automate this sort of thing for you.
Kevin Morris <kevr@0cost.org>
Hangs out in #archlinux-aurweb. Loves the AUR.
Offline
Hi kevr. Thanks.
Indeed, it works and I figured out a script to do it. However, I am suprised of not finding a simple connect <id_wanted_network> command.
If there is not, thanks for your time.
all different - all equal
Offline
Don't believe there is; however, I could be totally wrong.
I've never seen a reference to such a script in the wiki or anything like that for wpa_supplicant.
However... perhaps it would be neat if we contributed such scripts to an AUR package, which could add some convenient utilities for users like yourself in the future.
I would also have expected something along those lines to exist.
I think that, since a large portion of the community use things like NetworkManager, that the need for this is obscured below the high-level programs that exist.
For nerds like us though, who don't use NetworkManager, it'd be neat.
Kevin Morris <kevr@0cost.org>
Hangs out in #archlinux-aurweb. Loves the AUR.
Offline
Could be a good idea. I would be glad to create a AUR package for that (I am going to do several in the next months anyway on other projects).
However, I don't know how to do a connect method in this case.
What I am doing is:
wpa_cli -i wlp59s0 disconnect
wpa_cli -i wlp59s0 disable_network <id_A>
wpa_cli -i wlp59s0 enable_network <id_B>
wpa_cli -i wlp59s0 reconnect
But this is not a connect <id> method ...
all different - all equal
Offline
Just use different wpa_supplicant.conf excerpts, or rearrange the order of the network blocks in the conf file, then just do `wpa_cli reconfigure`.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Online