Solved wpa_supplicant ignoring priority

I am trying to instruct my machine to first try connecting to my main wireless network, and if it is not available then to connect to another. Both of which I know are constantly available, I have tried to achieve this with priority in wpa_supplicant.

However, it always connects to the second network.. I am unsure why. I cannot get it to prefer my main network at all

in my /etc/wpa_supplicant.conf, i have two networks set up like this

Code:
ctrl_interface=/var/run/wpa_supplicant
# real values subsituted with non-sense for my post here
network={
        ssid="networkA"
        priority=1
        bssid=c4:63:fe:6e:c8:60
        key_mgmt=WPA-PSK
        proto=RSN
        psk="whatever"
        priority=1
}


network={
        ssid="NetworkB"
        bssid=36:dc:9b:61:26:44
        key_mgmt=WPA-PSK
        proto=RSN
        psk="whatever"
        priority=2
}

Am I using the priority variable incorrectly..? It is my understanding that 0 is default, and the lower the number the bigger priority it is.
 
Am I using the priority variable incorrectly..? It is my understanding that 0 is default, and the lower the number the bigger priority it is.
It's exactly the opposite if I believe this: wpa_supplicant.conf(5)
priority
The priority of a network when selecting among multiple networks;
a higher value means a network is more desirable. By default
networks have priority 0. When multiple networks with the same
priority are considered for selection, other information such as
security policy and signal strength are used to select one.
 
  1. Signal strength is a factor.
  2. Give both of them same priority and switch NetworkB block to top of the wpa_supplicant.
  3. whatever is a bad password (shared key). Whatever!
  4. Does your config, catch the NetworkB, at all? Switch "Network-Wireless"/A off, and test it again.
[EDIT]: Program suggestion:
A temp solution: use net-mgmt/wifimgr to switch between the two.
 
I just subsituted that info with non-sense for my post here as it seemed like the sensible thing to do, those do not reflect their true values.

Didn't know signal strength mattered, guess that makes sense.

I am able to connect to both networks, if I switch one off, it connects to the other fine. The same is true reversed, both networks are accessible, and of similar signal strength. I will see if increasing the priority of network b even higher will help override the signal strength issue
 
# priority: Priority group
# By default, all networks and credentials get the same priority group
# (0). This field can be used to give higher priority for credentials
# (and similarly in struct wpa_ssid for network blocks) to change the
# Interworking automatic networking selection behavior. The matching
# network (based on either an enabled network block or a credential)
# with the highest priority value will be selected.


# priority: priority group (integer)
# By default, all networks will get same priority group (0). If some of the
# networks are more desirable, this field can be used to change the order in
# which wpa_supplicant goes through the networks when selecting a BSS. The
# priority groups will be iterated in decreasing priority (i.e., the larger the
# priority value, the sooner the network is matched against the scan results).
# Within each priority group, networks will be selected based on security
# policy, signal strength, etc.
# Please note that AP scanning with scan_ssid=1 and ap_scan=2 mode are not
# using this priority to select the order for scanning. Instead, they try the
# networks in the order that used in the configuration file.
 
Back
Top