This article demonstrates how to use a ping test and traceroute tools to test network connectivity between two hosts. Ping performs a basic test to determine if a remote host is available, while traceroute tests the complete route network packets take from one host to another. Traceroute is especially helpful for diagnosing where network slowdowns and congestion occur.
Many scenarios require you to test things locally on your computer using the command line. For example, if you are trying to test the connection between your computer and a remote host, a web-based tool cannot provide this information. It only tests the connection from its own server to the remote host.
The exact steps to use the ping and traceroute tools from the command line depend on your computer's operating system. Follow the appropriate procedures below for your operating system.
The basic ping test is one of the easiest things you can do to verify connectivity between your computer and a remote host. This test is easy to run from the command line.
To use the ping program on Microsoft Windows, follow these steps:
ping example.com
Interpret the output from ping:
C:\Documents and Settings\user>ping a2s78.a2hosting.com Pinging a2s78.a2hosting.com [216.119.143.98] with 32 bytes of data: Reply from 216.119.143.98: bytes=32 time=46ms TTL=54 Reply from 216.119.143.98: bytes=32 time=45ms TTL=54 Reply from 216.119.143.98: bytes=32 time=47ms TTL=54 Ping statistics for 216.119.143.98: Packets: Sent = 3, Received = 3, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 45ms, Maximum = 47ms, Average = 46ms
Alternatively, if the remote host is down, or not configured to respond to ping requests, you do not see any responses.
To use the ping program on Mac OS X and Linux, follow these steps:
At the command prompt, type the following command. Replace example.com with the domain that you want to test:
ping example.com
Press Ctrl+C to stop ping after a few tests run, and then interpret the output:
[email protected]:~$ ping a2s78.a2hosting.com PING a2s78.a2hosting.com (216.119.143.98) 56(84) bytes of data. 64 bytes from a2s78.a2hosting.com (216.119.143.98): icmp_req=1 ttl=54 time=44.4 ms 64 bytes from a2s78.a2hosting.com (216.119.143.98): icmp_req=2 ttl=54 time=43.8 ms 64 bytes from a2s78.a2hosting.com (216.119.143.98): icmp_req=3 ttl=54 time=44.7 ms
On the other hand, if the remote host is down, or not configured to respond to ping requests, you do not see any responses.
The traceroute program provides much more detailed information about a connection to a remote host than ping. Traceroute (or tracert on Microsoft Windows systems) displays information about each “hop” a packet takes from your computer to the remote host. It is often a good way to pinpoint possible ISP connection issues or network bottlenecks.
On Windows-based systems, use the tracert program to test the path to a server. To do this, follow these steps:
tracert example.com
Interpret the output from tracert:
C:\>tracert a2s78.a2hosting.com Tracing route to a2s78.a2hosting.com [216.119.143.98] over a maximum of 30 hops: 1 1 ms <1 ms <1 ms Linksys [192.168.0.1] [Lines omitted for brevity] 8 45 ms 38 ms 38 ms pos-1-6-0-0-pe01.350ecermak.il.ibone.comcast.net [68.86.87.130] 9 67 ms 150 ms 76 ms cr-1.sfld-mi.123.net [66.208.233.62] 10 44 ms 63 ms 46 ms gateway1.a2hosting.com [216.234.104.254] 11 72 ms 57 ms 63 ms a2s78.a2hosting.com [216.119.143.98] Trace complete.
You can examine the times between each hop to look for places where the connection “hangs”. In some cases, tracert may also time out, which is indicated by an asterisk (*).
To use the traceroute program on Mac OS X and Linux, follow these steps:
At the command prompt, type the following command. Replace example.com with the domain that you want to test:
traceroute example.com
Interpret the output from traceroute:
[email protected]:~$ traceroute a2s78.a2hosting.com 1 Linksys (192.168.0.1) 0.315 ms 0.452 ms 0.472 ms [Lines omitted for brevity] 8 pos-1-6-0-0-pe01.350ecermak.il.ibone.comcast.net (68.86.87.130) 39.010 ms 38.054 ms 38.092 ms 9 cr-1.sfld-mi.123.net (66.208.233.62) 45.056 ms 44.335 ms 44.974 ms 10 gateway1.a2hosting.com (216.234.104.254) 45.274 ms 46.650 ms 46.089 ms 11 a2s78.a2hosting.com (216.119.143.98) 44.654 ms 46.028 ms 43.852 ms
You can examine the times between each hop to look for places where the connection “hangs”. In some cases, traceroute may also time out, which is indicated by an asterisk (*).
MTR (“My Traceroute”) is a network diagnostic tool that combines the functionality of the ping and traceroute programs described above. It is a good way to monitor in real-time the path network packets take to their destination.
WinMTR is a version of MTR for computers running Microsoft Windows. To download WinMTR, use your web browser to go to https://sourceforge.net/projects/winmtr, and then install the program on your computer.
After you install WinMTR, follow these steps to run a network test:
MTR may already be installed by your Linux distribution. If it is not installed, you can install it using your distribution's package manager (for example, apt-get or yum). After MTR is installed, follow these steps to run a network test:
mtr --curses example.com
The previous command starts MTR in text mode. If your Linux installation has a desktop environment installed, you can type the following command to start MTR with a GUI instead:
mtr --gtk example.com
MTR continually tests connectivity to the host, displaying the packet route and total number of pings:
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.
We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.