I recently ran into an issue with my Raspberry-based radio node. I tried to connect to some othet WiFi access points and I realized that I had no idea how to set connection priorities if I have multiple candidates for connection. I was used with wpa-supplicant way of doing things which was just to add a line specifying the priority. The higher the number, the higher the priority:
network={ ssid="ssid" psk=psk key_mgmt=WPA-PSK priority=80 }
However, I was not sure how this is done in the NetworkManager‘s world. As I built my radio node with the sole intention of having a mobile VHF/UHF connection the RoLink network, configuring etwork manager to be able to choose various WiFi hotspots is very important.
It seems it is pretty simple. One has to edit the corresponding connection settings in /etc/NetworkManager/system-connections and add an autoconnect-priority information in [connection] section:
[connection]
id=iPhone
uuid=
type=wifi
autoconnect-priority=300
interface-name=
Alternatively, this can be done with nmcli command:
tom@rpi-yo3iti: sudo nmcli c modify iPhone connection.autoconnect-priority 300
Connections with higher priority will be preferred. The higher number means higher priority. 11 takes precendence over 10, for example. The default setting is 0.
That’s it. Simple.