Hello guys! I have this problem:
I have two wifi connections, and want assign higher priority to one of them. So I created two files in the system-connections folder, and put a bigger autoconnect-priority value to one of them.
The problem is: when both networks are available, it always connects to the same one.
I want my device to connect to the one with ssid=secondnetwork if both available
What can I do?
Here is the content of the files:
File #1:
[connection]
id=randomid
type=wifi
autoconnect-priority=0
[wifi]
hidden=true
mode=infrastructure
ssid=random
[ipv4]
method=auto
[ipv6]
addr-gen-mode=stable-privacy
method=auto
[wifi-security]
auth-alg=open
key-mgmt=wpa-psk
psk=randompassword
File #2:
[connection]
id=secondnetwork
type=wifi
autoconnect-priority=1
[wifi]
hidden=true
mode=infrastructure
ssid=Hackers
[ipv4]
method=auto
[ipv6]
addr-gen-mode=stable-privacy
method=auto
[wifi-security]
auth-alg=open
key-mgmt=wpa-psk
psk=42424242
Hello Friends! Any help here? I have not been able to set my wifi priority yet
Same here. Autoconnect-priority does not work, despite having a great number in it.
EDIT: Tested here inverting the numbers. It worked! Weird… Perhaps it’s because of me not being a native english speaker. For me, highest priority means a great number. But it looks like it’s the oposite.
So: autoconnect-priority=100 executes BEFORE autoconnect-priority=1000.
@hecontreraso were you able to set priorities with the hint from @arthurmoises?
For anyone stumbling on this post, higher number for auto-connect means higher priority. This post initially ran us down a goose chase.
https://developer.gnome.org/NetworkManager/stable/nm-settings.html
The autoconnect priority. If the connection is set to autoconnect, connections with higher priority will be preferred. Defaults to 0. The higher number means higher priority.
We ran into several issues getting this going. What worked in the end was removing all files in:
/etc/NetworkManager/system-connections
Then, in /mnt/boot/system-connections/
add a new “resin-wifi” file and add autoconnect priority (higher number higher priority) as well as explicitly set autoconnect to true for good measure. The connection portion of your wifi file should look like the following:
[connection]
id=<some_id>
type=wifi
autoconnect-priority=10
autoconnect=true
Note, this should work for new connection files in /etc/NetworkManager/system-connections
as well, We just found clearing the existing network manager connections helped keep track of what was working as we were debugging auto-connect.
Thanks @alexanderkjones for posting an answer to this question. It seems to me like autoconnect=true
was the missing part of the puzzle.