1

I need to set up the pi so, that when one network comes in range it would disconnect from existing one and connect to that one more preferred.

Here is my interfaces file:

auto lo
iface lo inet loopback

# Built in eth interface
allow-hotplug eth0
iface eth0 inet static
        address 192.168.0.11
        gateway 192.168.0.10
        netmask 255.255.255.0
        network 192.168.0.0
        #broadcast

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
        wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf


allow-hotplug eth1
iface eth1 inet dhcp

And here is the wpa_supplicant.conf:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="network(1)"
        psk="xxx"
        priority=5

}
network={
        ssid="network(2)"
        psk="xxx"
        priority=10
}

What I am missing here? Or does it just not work that way?

2 Answers 2

1

Priority only applies when the network adapter is actively looking for a connection and finds both on the list. Then the connection with the higher priority is the one that is connected.

If you are already connected, the connection will not drop itself when a connection with higher priority is found.

0

Run a network command such as iwlist:

Create a script that will execute/run on an interval/loop and will gather all of the available network connections.

Using a command such as grep/etc it is possible to sift through the unwanted text to find points of interest such as: ssid, quality, etc.

In the same script you can simply use another command to connect to the resulting wifi connection that offers the highest quality signal.

For example:

networksetup -setairportnetwork en0 yourSSID yourPASSWORD

works for a mac.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.