I Automated What You Do When Your Internet Connection Drops

The East Coast suffered Hurricane Sandy today. With the lights flickering off for brief moments every half hour or so, I decided it was time to stop hastily typing “ping” commands to diagnose my connectivity problems and so I wrote something to do it better. The result is a script that intelligently tests your networking hardware for connectivity.

It does 3 things:

  1. Ping the local gateway to make sure the hardware is working
  2. Ping the ISP to make sure that link is working
  3. Ping an Internet address to make sure that connectivity exists

Blasting ICMP packets at the Internet as fast as you can is not considerate. You want to ping your gateway quickly so that you know immediately when it comes up. Once you have internet connectivity though, you can ping more slowly.

Continue reading