Sticky Wifi

Sticky Wifi is an issue that seems to plague any network administrator that manages a wireless network with more then one AP, the issue is that the client device does not go out and check for better signal access points. It stays connected to the same AP basically until it can’t see it anymore.

I honestly had never thought of this issue until someone was giving a presentation about Aruba Networks they has supposedly fixed the problem. The issue for me was the cost of entry was really high, and how could they have fixed the client side of the problem… At this point the Gauntlet had been thrown down, and I wanted to see if there was a cheaper way to fix this issue.

1. Raspberry Pi Model B Amazon Prime $37

2. Ralink 5370 Amazon Prime $8.00

3. GPIO light (had two sitting around)

So how can we control the client? How can we make the client do something he’s not supposed to do, connect to a better signal AP??

My Answer? Threshold level, the AP was able to see the current signal level of the client using:

iw dev wlan0 station dump

This gave all sorts of good information about the connected clients, and it looked easy enough to parse (see sticky-client.js pollclients).

Ok so good there I can set a particular signal level, to disconnect the client, but how can I disconnect the client???

My beginning attempts of:

hostapd_cli disassociate xx:xx:xx:xx:xx:xx

was a massive failure. I found the clients would drop the connection then immediately reconnect. I also found as a side affect the iPhone quits trying to connect after 3 drops in a short amount of time.

I was about ready to give up but I thought I would take another quick peek at the man page, and I found the answer… /etc/hostapd.deny. I could append this mac address if only temporarily from this AP to a

kill -HUP hostapd

, forcing it to rescan, for other AP’s and I couldn’t believe it I had the answer and it worked. I could then remove the MAC from the hostapd_deny and they could reconnect, but by now they were already connected to a better signal AP.

How could I hook this all together?

I built a node js server/client. That’s right I said nodejs server and client.

The sticky-client.js connects back to the the predefined server. The server then sends requests at Intervals.

one of the server requests is pollclients, this sends back the mac and the current signal level of everyone associated, the server then makes a decision of how can be connected. If the server determines the client has too weak of a signal, it sends a shutoff command which causes the client to block connection attempts, the server also sets and interval of 1 second that causes the client to reenable that mac address, 1 second in my testing was more then enough time, to allow the client to connect somewhere else.

Lastly how could I know which Raspberry pi the client was connected to? simple a light that would light from the GPIO based on a predetermined MAC address, the server would send a lightgpio command to the client when it saw the client moved.

This experiment ended up being a lot of fun, In the end I am sure we will choose a commercial product, but I just needed to prove to myself that this was possible using open source, and it was.

See it in action:
Sorry for the poor quality.

Thanks!

John “Come fly the friendly skys” Hass

Client/Server Code:
sticky.zip

Leave a Reply

Your email address will not be published. Required fields are marked *