1

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:

  1. It will periodically (temporarily, for about 10 seconds) interrupt the connection of my computer when trying to connect to wifi2.
  2. 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.

7
  • nmcli connection modify wifi2 connection.autoconnect-priority 10
    – petep
    Commented Jun 14 at 13:14
  • @petep sorry if it was not already clear, but this is already applied. You can suppose I have already set the connection.autoconnect-priority to 2 for wifi2, and 1 for wifi1.
    – gruvw
    Commented Jun 15 at 7:54
  • Note that the computer has a single network interface (let's say wlan0) and I don't really want to split it up (to scan for networks while already connected).
    – gruvw
    Commented Jun 17 at 9:24
  • Wouldn't you think #1 is why it's not supposed to behave like that in the first place?
    – WU-TANG
    Commented Jun 18 at 4:08
  • "connection.autoconnect Alias: autoconnect Whether or not the connection should be automatically connected by NetworkManager when the resources for the connection are available.......................................................... Autoconnect happens when the circumstances are suitable. That means for example that the device is currently managed and not active. Autoconnect thus never replaces or competes with an already active profile."..... judging by that, your solution is seemingly going to have to be clunky.
    – WU-TANG
    Commented Jun 18 at 4:17

0

You must log in to answer this question.

Browse other questions tagged .