I am using Network Manager (nmcli
) to configure two connections to two different Wi-Fi networks wifi1
and wifi2
.
I have set up a higher connection.autoconnect-priority
for wifi2
(let's say 2
) than for wifi1
(let's say 1
).
I wish to have Network Manager to always connect to the Wi-Fi network that has the highest priority.
My current configuration works perfectly when only one of the two Wi-Fi networks is available (selects the one that is available). It also works when both Wi-Fi networks are available, and I activate (turn on) the Wi-Fi on my computer (it will select the one that has the highest priority).
However, it starts to fail when there is only one available network (wifi1
, meaning it is already connected to it) and then the higher autoconnect priority network (wifi2
) becomes available.
It won't disconnect from wifi1
and connect to wifi2
automatically.
I think this is because Network Manager does not try to "auto-connect" to the other connections once it already has an active connection.
Is there a way to force Network Manager to always connect the highest autoconnect priority network, even if it already has another active connection ?
The only workaround that I found to enforce this behavior is to periodically (let's say every 10 minutes) run the command sudo nmcli c up wifi2
.
Basically, it will try to connect to wifi2
and if not available, it will fall back to wifi1
automatically (thanks to autoconnect).
There are two problems with this workaround:
- It will periodically (temporarily, for about 10 seconds) interrupt the connection of my computer when trying to connect to
wifi2
. - It has a slow "reaction time" to connect to the higher priority connection, of the set retry period (10 minutes).
I hope that there is a (better) solution to this problem, thank you very much.
connection.autoconnect-priority
to2
forwifi2
, and1
forwifi1
.wlan0
) and I don't really want to split it up (to scan for networks while already connected).