Because the walls of my house are thick and tend to attenuate wireless signals badly, I have two access points in different parts of my house, configured on the same SSID with the same settings. Both work well in general. However, in a similar way to that observed by this user, I find that moving my laptop from one room to another doesn't cause it to switch access points quickly enough; either its rescanning is too infrequent, or the threshold of signal quality is too low, or both. This leads to an irritatingly long period where the network won't respond.

Can I control this at all on Linux? (which is what my laptop runs - more specifically, I have CrunchBang, a Debian variant, if it matters). I'd like to be able to alter that signal threshold and/or rescan period if possible to make it more aggressive at switching.

  • 1
    As I'll always suggest when I see a crunchbang post, ask in #crunchbang on irc.freenode.net as well. xchat is installed with crunchbang, and #crunchbang automatically connects when you start it. – Rob Jun 25 '12 at 17:51
  • Thanks. I doubt somewhat this is specific to CrunchBang which is why I thought I'd ask a wider audience first. But thanks for the tip. – Andrew Ferrier Jun 25 '12 at 17:54
  • I usually search around here as well as ask in the chan. Depending on who is in the channel, you'll get an answer pretty quickly. I know that #! uses gnome-network-manager by default, you might have better luck with a different network manager. – Rob Jun 25 '12 at 17:57

It takes a while for the network manager to decide that the connection is not coming back and only then will it try to reconnect. I find wicd to be more "responsive" than NetworkManager - I'd consider switching to that.

You could also run a background script that polls the signal strength and forces a disconnect if the signal falls beyond a certain level. Once disconnected your network manager will normally connect to a network with stronger signal.

Example script using iw(1) from the iw package:

while true; do
        signal=$(iw $IFACE link | grep signal | awk '{print $2}')
        [ $signal ] && [ $signal -lt $LIMIT ] && iw $IFACE disconnect
        echo $signal
        sleep 1

The Access points keep stateful information about your device - you cannot just magically roam from one to another by matching parameters. Big companies like Aruba solve the problem by putting an "access router" in 1 spot in a building and then each "access point" is just an antenna and line card into the access router. Home access points have none of this magic.

Unless the access points are talking to each other via some magic protocol, I would imagine you are creating huge troubles for your access points because some unknown MACID shows up and has the WEP/WPA password but has not associated it, and so they have no allow IP address assignment, and so they are not allowed to send packets, and this probably confuses the wpa_supplicant to no end on your own workstation, in addition to the access point.


Roaming between access points is managed by wpa_supplicant, so to switch to a particular access point without dropping the connection for longer than needed, use wpa_cli roam. For example:

rav@fred:~$ sudo wpa_cli -i wlp58s0 scan_results 
bssid / frequency / signal level / flags / ssid
60:45:cb:94:d1:50   2447    -47 [WPA2-PSK-CCMP][ESS]    NextDoorBut1
cc:e1:d5:7c:af:a8   2417    -75 [WPA2-PSK-CCMP][WPS][ESS]   NextDoorBut1
10:6f:3f:4c:54:83   2427    -70 [WPA2-PSK-CCMP][ESS]    NextDoorBut1

rav@fred:~$ sudo wpa_cli -i wlp58s0 roam 60:45:cb:94:d1:50

This only works for switching between APs on the same SSID, of course - and it requires you to do a bit of prior research to figure out the BSSID for each AP.


try this way :

ID1="wireless network name"
ID2="wireless network name"

ssid=$(iw $IFACE link | grep SSID | awk '{print $2}')
signal=$(iw $IFACE link | grep signal | awk '{print $2}')

if [ $signal -lt $LIMIT ]
then case $ssid in
    $ID1) nmcli con up $ID2
    $ID2) nmcli con up $ID1
    esac &&
    ssid=$(iw $IFACE link | grep SSID | awk '{print $2}') && echo you are now connected to $ssid
else echo "no changes needed"

sleep 1
  • 1
    Welcome to Super User! Can you explain your code -- by editing your answer -- to help those who might not understand it all? Thanks :) – bertieb May 1 '18 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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