What command can be used to determine whether a workstation’s network connection is working?

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.

For a general introduction to network troubleshooting, please read this article first.

Table of Contents

  • Testing network connectivity
    • Check host availability with ping test
      • Using ping test on Microsoft Windows
      • Using ping test on Apple Mac OS X and Linux
    • Testing the path to a remote host with traceroute
      • Using tracert on Microsoft Windows
      • Using traceroute on Apple Mac OS X and Linux
    • Testing network connectivity with MTR
      • Using MTR on Microsoft Windows
      • Using MTR on Linux

Testing network connectivity

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.

Check host availability with ping test

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.

Using ping test on Microsoft Windows

To use the ping program on Microsoft Windows, follow these steps:

  1. Open a DOS command window. To do this, click , click , type cmd, and then press Enter.
  2. At the command prompt, type the following command. Replace example.com with the domain that you want to test: ping example.com
  3. Interpret the output from ping:

    • If the remote host is active and configured to respond to ping requests, responses appear. For example, the following output shows ping responses from an A2 Hosting server: 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.

      Firewalls can be configured to block packets from ping. If a remote host does not respond to ping requests, it is possible that it is up and running normally, but ignoring ping requests.

Using ping test on Apple Mac OS X and Linux

To use the ping program on Mac OS X and Linux, follow these steps:

  1. Open a terminal window. The procedure to do this depends on your operating system and desktop environment:
    • On Mac OS X, click Applications, click Utilities, and then click Terminal.
    • On Linux, open a terminal window.
  2. At the command prompt, type the following command. Replace example.com with the domain that you want to test:

    ping example.com
  3. Press Ctrl+C to stop ping after a few tests run, and then interpret the output:

    • If the remote host is active and configured to respond to ping requests, responses appear. For example, the following output shows ping responses from an A2 Hosting server: [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.

      Firewalls can be configured to block packets from ping. If a remote host does not respond to ping requests, it is possible that it is up and running normally, but ignoring ping requests.

Testing the path to a remote host with traceroute

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.

Using tracert on Microsoft Windows

On Windows-based systems, use the tracert program to test the path to a server. To do this, follow these steps:

  1. Open a DOS command window. To do this, click , click , type cmd, and then press Enter.
  2. At the command prompt, type the following command. Replace example.com with the domain that you want to test: tracert example.com
  3. Interpret the output from tracert:

    • Tracert displays each hop, indicated by a number in the left column. It also displays the domain and IP address at each hop, as well as the time spent. For example, the following output shows the path to an A2 Hosting server: C:\>tracert a2s78.a2hosting.com Tracing route to a2s78.a2hosting.com [216.119.143.98] over a maximum of 30 hops:   1     1 ms   

Chủ Đề