# Roaming between BSSIDs with wpa_supplicant

## hampelratte

Today I set up a second wifi access point for my network. Both access points (WRT54Gl in AP mode) are connected through cables to the ethernet network. They are configured to have the same SSID and the same authentication method. The only difference is the wifi channel (5 and 10). As far as I know this should be the right configuration for such a wifi network.

My laptop treats both access points as one network. Dependent on where I connect to the network one or the other AP is used. I didn't even have to touch the wpa_supplicant config. So this is all good. But when I move from one AP to the other, wpa_supplicant should switch to the AP with the better signal, which isn't happening. Only, if I trigger a scan with wpa_cli or wpa_gui, it switches to the better AP. If I'm not mistaken, the config parameter bgscan should solve this problem, but it doesn't make any difference, if I specify it or not. Does anyone know, how I can get wpa_supplicant to roam between the different BSSIDs?

Here is my config:

```
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel

update_config=1

network={

        ssid="my_network_name"

        scan_ssid=1

        bgscan="simple:5:-60:300"

        psk="xxxxxxxxxxxxxxx"

        priority=9

}
```

----------

## khayyam

 *hampelratte wrote:*   

> 
> 
> ```
> bgscan="simple:5:-60:300"
> ```
> ...

 

hampelratte ... that states that if the signal is better than -60dBm then bgscan happens every 5 minutes, if it falls bellow then bgscan happens every 5 seconds. So, should it fall bellow -60dBm you'll probably not reach the end of the scan, and a reassoc, before another scan is called, I'd suggest increasing this to at least 30, if not 120. You may also want to increase the top bgscan time as effectively your calling this every 5 minutes *even if* the signal is at maximum, 600 may be a better value.

The effectiveness of the above really depends on the signal level of both AP's, I don't think that bgscan is that effective if your AP's are such that the signals overlap ... it's more a matter of passing on from one signal boundary to another (ie, the sort of coverage expected in a 'roaming' environment, a campus or similar).

best ... khay

----------

## hampelratte

You might be right with the time intervals, so I changed it to 30 and 600. But it still has no effect. If I move to the other AP, the signal drops to less than -70 dB. With the -60dB threshold, there should be scan, but nothing happens. Even after more than a minute there is no indication, that wpa_supplicant does anything. If I then enter scan in wpa_cli, it immediately switches to the AP with the better signal.

Edit: BTW, my android phone switches between the APs, so the setup should be OK.

----------

## khayyam

 *hampelratte wrote:*   

> You might be right with the time intervals, so I changed it to 30 and 600. But it still has no effect. If I move to the other AP, the signal drops to less than -70 dB. With the -60dB threshold, there should be scan, but nothing happens. Even after more than a minute there is no indication, that wpa_supplicant does anything. If I then enter scan in wpa_cli, it immediately switches to the AP with the better signal.

 

hampelratte ... it's late for me now so I won't be able to look at it until tommorow but can you add '-dd -f /var/log/wpa_supplicant.log' to your wpa_supplicant parameters and pastebin the log? You seem to be suggesting that bgscan is never run ... but without the log I can only guess. 

 *hampelratte wrote:*   

> Edit: BTW, my android phone switches between the APs, so the setup should be OK.

 

You mean with the same config?

best ... khay

----------

## hampelratte

Here is the console output: http://pastebin.com/QnytYgCT

I mentioned, that the roaming works with my phone, just to clarify that the setup of the APs allows devices to roam.

----------

## khayyam

 *hampelratte wrote:*   

> Here is the console output: http://pastebin.com/QnytYgCT

 

hampelratte ... that seems to only show daemonisation, no ASSOC, or debug, you need to use '-dd -f /var/log/wpa_supplicant.conf', replicate the circumstances in which you expect the handover, and pastbin the log. 

best ... khay

----------

## hampelratte

I'm sorry, here is the complete log (I only cut out some stuff from unrelated networks): http://pastebin.com/yt1R8tgN

And here is the log of wpa_cli, which I'm going to describe: First I connected to one of the APs and did a signal_poll, which returns a signal strength of -29dB. Then I walked over to the other AP and did a signal_poll again. As you can see, the signal strength dropped to -74dB and way below the threshold. When I walked over nothing happend on the console. No indication of background scanning due to breaking the threshold. After some time, I issued a scan to show you, that wpa_supplicant actually switches to the other AP, because it has a better signal. But again, this only happens, if I trigger a scan.

```
Connection to wpa_supplicant re-established

> signal_poll

RSSI=-29

LINKSPEED=48

NOISE=-81

FREQUENCY=2432

WIDTH=20 MHz (no HT)

AVG_RSSI=-29

> signal_poll

RSSI=-74

LINKSPEED=48

NOISE=-81

FREQUENCY=2432

WIDTH=20 MHz (no HT)

AVG_RSSI=-75

> scan

OK

<3>CTRL-EVENT-SCAN-STARTED 

<3>CTRL-EVENT-SCAN-RESULTS 

<3>SME: Trying to authenticate with 00:1e:e5:46:0e:f0 (SSID='my_network_name' freq=2457 MHz)

<3>Trying to associate with 00:1e:e5:46:0e:f0 (SSID='my_network_name' freq=2457 MHz)

<3>CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD

<3>Associated with 00:1e:e5:46:0e:f0

<3>WPA: Key negotiation completed with 00:1e:e5:46:0e:f0 [PTK=CCMP GTK=CCMP]

<3>CTRL-EVENT-CONNECTED - Connection to 00:1e:e5:46:0e:f0 completed [id=0 id_str=]

<3>CTRL-EVENT-DISCONNECTED bssid=00:1e:e5:46:0e:f0 reason=3 locally_generated=1

<3>CTRL-EVENT-TERMINATING 

Connection to wpa_supplicant lost - trying to reconnect

Connection to wpa_supplica
```

----------

## khayyam

 *hampelratte wrote:*   

> I'm sorry, here is the complete log (I only cut out some stuff from unrelated networks): http://pastebin.com/yt1R8tgN

 

hampelratte ... I'm not seeing a bgscan there, the issue however may be that you're setting 'scan_ssid=1', please try again without it (again with debug and log).

best ... khay

----------

## hampelratte

That didn't make any difference. I guess either this feature does not work, or my device does not support it or something like that.

----------

