Monday, September 17, 2007

Simple network uptime test

Trying to troubleshoot an intermittent network problem? Just want to know if you ISP is dropping packets or going down altogether?

So many times I've search the 'net for a simple network uptime script. I always wanted to know the exact time the network went down (and came back up) so that I could track down the cause of the problem. Here is a dead-simple script that will do just that:

## ##
## This script continually pings an IP address / hostname and reports *only*
## when it is unable to reach the destination.
## Example: ./

if [[ $1 == "" ]];
echo "Please provide an IP/host to ping"

while [ true ]; do
p=`ping -c 4 $1 > /dev/null 2>&1`
if [[ $? != 0 ]];
echo "Unable to reach $1 at $d"
sleep 1

It works best if you open up multiple terminal windows and try to connect to different portions of your network simultaneously. For example:

./ [my neighboring workstation]
./ [my gateway]
./ [my ISPs DNS]
./ [random domain - ie. or]

This way, you can determine exactly where the failure is AND you have a record of the time it occurred. Hope that helps!

1 comment:

  1. If you’re touring in considered one of these nations and you’re having bother accessing the service, you can use use|you need to use} a VPN to switch your location to your own home} country. IPVanish boasts excellent safety, utilizing 256-bit encryption and ideal forward secrecy to keep your connection secure. A built-in kill swap adds 벳익스플로어 an additional layer of protection by stopping all knowledge switch should the VPN connection drop. It supplies DNS leak protection and doesn’t monitor any searching activity or maintain connection logs. In case of questions or issues, you could have} entry to 24/7 stay chat help. IPVanish Fast and reliable service with good secure servers and apps.