Am I back online?

A palliative solution for the wifi drop on Mavericks


The problem

Me and plenty of other people are experiencing unexpected wifi drops on Mac OS X. Out of nowhere your Dropbox gets disconnected, the browser stops loading pages and your computer is offline. All the other devices in my house are still connected and working flawlessly. A few minutes later (usually one hour), the computer comes back online.

Despite being frustrated of being offline, I spent this time reading a book, studying something or reading articles. It was very productive and a good experience stay disconnected, but my addiction to internet is bigger. From time to time I caught myself focusing out of my book just to check if the internet was back. How could I solve this?

Solution

I wrote a simple script using the airport software (native on all Macs) that tries to connect to the internet. If the internet is still down, it sleeps for 7 seconds and keep trying. If the internet is back, you are alerted with a cool virtual voice saying: "Back online".

To use the script, just copy it on a file with .sh extension. You will need to open the file and replace the WIFI_NETWORK_NAME and WIFI_PASSWORD with your credentials. Don't worry, it is perfectly safe. It is so safe that I even left mine public on GitHub! After that, just execute the script on the terminal. When the internet is back, a sound will be emitted. Enjoy your reading time!

Theories

I've read a lot of attempts to permanently fix the issue. The one that seems more promising is renewing the DHCP lease. This can be done on the Network Preferences menu (System Preferences > Network > Advanced > TCP/IP > Renew DHCP Lease).

Renewing DHCP Lease seems a promising approach on restoring the wifi connectivity.

Reboot, turning the router off and on, connecting another device to the local network seems to help, but I cannot assure that any of these methods works. It appears to be totally random.

I found a strong correlation on using the Transmission app and internet drops. Several disk images from Linux Distributions can be downloaded faster on a P2P network (e.g, Xubuntu, Arch Linux). Reducing the maximum numbers of peers that can be connected at the same time could be a possible solution.

Future

More theories and solutions are more then welcome, please post it here to help others!

If you found the script useful, feel free to download, use and modify it in any way you want. If you run into trouble, I'm on twitter :-)