Page 1 of 1

[SOLVED] switching between multiple access points

Posted: Fri Apr 12, 2013 10:21 am
by semicolon
I have a local network with a repeater bridge in it. That means I have a network with 2 (wireless) access points, the first one is connected to the modem, the second is to extend the signal. Both are broadcasting using the same SSID. If I am upstairs with my laptop (where I usually am) I have a very poor connection with the first access point, that's what the second access point is for. All this works like a charm and I am very happy with it.

The only problem is that sometimes, out of the blue, something causes my laptop to decide to change the access point. And I am left with a very unstable internet connection. Sometimes I am able to (temporarily) change the access point back using below command, but sometimes it doesn't do anything at all.

Code: Select all

sudo iwconfig wlan0 ap <MAC ADDRESS>
What I actually want is a way to choose between the different access points manually (and then force the connection through that access point). But I am not sure if that is possible, so if you know any other solution or a way to notify me when the access point changes that would already be helpful. Thanks in advance.

Re: switching between multiple access points

Posted: Mon Apr 15, 2013 6:39 am
by semicolon
I changed the channels on which the routers are broadcasting to channel 1 and 6, so that they don't overlap any longer. It seems to have reduced the number of switches between the access points.

I also manged to let a notification show when the wireless access point changes with the script below. I run it at boot now.

Code: Select all

#!/bin/bash

CURRENT_WLAN_AP=$(iwgetid wlan0 --ap | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}')

while true; do
	NEW_WLAN_AP=$(iwgetid wlan0 --ap | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}')
	if [[ "$NEW_WLAN_AP" != "$CURRENT_WLAN_AP" && "$NEW_WLAN_AP" !=  "" ]]; then
		CURRENT_WLAN_AP=$NEW_WLAN_AP
		notify-send "Access point changed to $NEW_WLAN_AP"
	fi
	sleep 10
done
But I would still prefer to force the computer to use a certain access point. Has anybody any idea?

Re: switching between multiple access points

Posted: Fri Apr 19, 2013 10:59 am
by semicolon
New laptop arrived and it seems to have no problems whatsoever using either of the access points 8)

I can also change the access point manually with the command in my first post now, but ironically there's no need any more. Anyway, problem solved.