Knowledge Base/Web Hosting/Troubleshooting

Using traceroute and ping to troubleshoot connectivity problems.

Jeremiah Stanley -
posted this on March 30, 2012, 1:12 PM

The internet is a very reliable and robust network, but problems do occur. Often to troubleshoot it's nice to utilize some command line tools to get down into the 'nuts and bolts' of a problem. Your website will fail to load in your browser for many reasons; the web server may be down, there may be a network outage, the Cylons have revolted. Two programs will help you test your connectivity to the web server and the internet in general. The first is ping, here is how to find this on your computer:

Windows: Click 'Start' or the Windows logo in the lower left of your screen. Locate the 'Run' dialog and enter the text 'cmd' and press Enter.
Mac: In the upper right of your screen there is a magnifying glass icon. Click this and enter the text 'terminal' and press enter.

This should bring up a terminal interface to your computer. On my Mac, this is what it looks like:

You will see a prompt where we will enter text and a window where the results of our commands are displayed. Let's start with ping, a tool that will send packets of data across the internet to a another machine (often these are called hosts). Sitting at my machine if I want to see if the machine is hosted on is reachable I'd use the following command:


This command does a few things. First, it tries to look up the address associated with that hostname. If the hostname doesn't have an IP address associated with it it will return the text "ping: cannot resolve HOSTNAME: Unknown host". If the hostname does have an IP associated with it it will send packets to that address, and the host on the other end will send them back. This is displayed like this:

Mal:~ jstanley$ ping
PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=248 time=3.532 ms
64 bytes from icmp_seq=1 ttl=248 time=3.196 ms

On my Mac this command will continue to send packets until I terminate the command by pressing CTRL-c on my keyboard. On a Windows machine ping will only send four packets unless you tell it to send more. Let's take a look at the information returned. The first line after the command is summarizing what will be performed, essentially sending 56 bytes of data to the address The next line is what is returned for each packet we sent. We received 64 bytes from the address we specified, in a sequence, and this happened in just under 4 milliseconds.

This indicates to us that the host we 'pinged' is up and responding to network traffic, it may not be responding to web site requests however. If you get successful ping responses you can reach the machine in question, if not there may be a network issue or the machine may be down. Sometimes if there is an intermittent connectivity issue, you'll see that there are failed packets occurring in the output. It's a good thing to check that the IP that is pinged in your command is the same as you expect it to be in your DNS settings for your domain.

The next utility we are going to look at is traceroute (or tracert on Windows). This works just like ping did, we will pass it a hostname, it will resolve the IP associated with it. The difference is that traceroute will contact all the intermediary routers along the way between your machine and the hostname you are pinging. It will look something like this:

Mal:bin jstanley$ traceroute
traceroute to (, 64 hops max, 52 byte packets
 1 (  13.773 ms  3.013 ms  1.522 ms
 2 (  22.604 ms (  6.301 ms  2.975 ms
 3 (  3.740 ms  3.353 ms  3.985 ms
 4 (  5.719 ms  6.763 ms  7.891 ms
 5 (  2.767 ms  37.889 ms  2.822 ms
 6 (  4.058 ms  4.379 ms  4.415 ms
 7 (  3.011 ms  3.992 ms  4.370 ms
 8 (  3.157 ms  3.818 ms  3.003 ms

There is the sequence number on the left, the IP or hostname of the router next. After that there is timing information listed in milliseconds. This traceroute was successful and reached it's destination. However if it were not, the command would fail and display a few asterix when it cannot reach routers in between. This will indicate where the connection problem is occurring. Sometimes this can be with your local ISP, or maybe even at the location of your hosting provider.

Topic is closed for comments