Wireless networks are dynamic by nature. A few people between you and your access point (AP) may cause signal degradation, which you may or may not notice depending on what you are doing on your device. A more common issue I’ve encountered a lot at crowded places (coffee shops, big auditoriums, concert halls) is the complete inability to connect to the network, despite having had no issues connecting during previous visits. This causes even more frustration because I expect the WiFi to be working since it worked before.
When a device fails to connect to an AP, it will try another one in range, and it may keep going in circles for a while. The good news is that if it ever manages to connect, it will most likely stay connected for a while, and somebody else’s device will be going in circles. Now, even though you manage to connect to the WiFi, whether you will have good experience is a different story…
These kinds of issues, and many others, are difficult to detect and monitor. The only way to capture them is to use sensors that measure and keep historical information on the wireless network performance. In a previous post, Stefano described how to convert a Raspberry Pi into a network sensor to track metrics such as latency, DNS resolution and HTTP response time, as well as signal strength and quality. Here we describe how you can take this one step further to monitor AP association/dissociation.
We’ll start with the assumption that you have configured your Raspberry Pi as a network sensor. Once it’s connected to an AP, NetBeez can monitor network and application performance with Ping, DNS, HTTP, Traceroute, Ookla SpeedTest, and iPerf. Here is what an hourly Ookla SpeedTest looks like:
Setting Up the Cron Job
To test the association/dissociation, the Raspberry Pi needs to disconnect and then try to reconnect to the network. This can be achieved by running a periodic cron job that disables and then reenables the wlan0 interface. You can either create a cron job with “crontab -e” or create a cron file in /etc/cron.d. We’ll go with the latter option, and create the cron file /etc/cron.d/wifi-updown-cron with the following contents:
*/5 * * * * root /sbin/ifdown wlan0; /sbin/ifup wlan0
Note: if you decide to name the cron file differently, please make sure you don’t add an extension to the file, because cron won’t execute it.
This will run the association/dissociation script every five minutes. This is captured on the NetBeez dashboard, where you can see the periodic connection drop (red mark) and reconnection (green mark):
As you see above, the Raspberry Pi doesn’t have any problems with the association/dissociation, because it’s set up to test that part of your wireless network.
To summarize, to get started with NetBeez WiFi monitoring:
- Request a NetBeez trial dashboard.
- Make your Raspberry Pi a wireless sensor following these instructions.
- Test AP association/dissociation by following the instructions above.
If you wish to learn more about it, download the WiFi monitoring guide from the client perspective.