Knowledge Base/Web Hosting/Troubleshooting

Using traceroute and ping to troubleshoot connectivity problems.

Jeremiah Stanley - http://www.name.com/cs/jeremiah
posted this on March 30, 2012 01: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:
terminal.png

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 Name.com is hosted on is reachable I'd use the following command:

ping name.com

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 name.com
PING name.com (4.79.81.148): 56 data bytes
64 bytes from 4.79.81.148: icmp_seq=0 ttl=248 time=3.532 ms
64 bytes from 4.79.81.148: 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 4.79.81.148. 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 name.com
traceroute to name.com (4.79.81.148), 64 hops max, 52 byte packets
 1  107.0.83.89 (107.0.83.89)  13.773 ms  3.013 ms  1.522 ms
 2  xe-0-3-0-0-ar03.aurora.co.denver.comcast.net (68.85.89.22)  22.604 ms
    te-0-4-0-2-ar02.denver.co.denver.comcast.net (68.86.179.25)  6.301 ms  2.975 ms
 3  te-0-2-0-7-ar02.aurora.co.denver.comcast.net (68.86.179.33)  3.740 ms  3.353 ms  3.985 ms
 4  pos-3-6-0-0-cr01.denver.co.ibone.comcast.net (68.86.91.1)  5.719 ms  6.763 ms  7.891 ms
 5  4.79.82.53 (4.79.82.53)  2.767 ms  37.889 ms  2.822 ms
 6  ae-21-52.car1.denver1.level3.net (4.69.147.99)  4.058 ms  4.379 ms  4.415 ms
 7  4.79.81.182 (4.79.81.182)  3.011 ms  3.992 ms  4.370 ms
 8  4.79.81.182 (4.79.81.182)  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