Tech Note: Command Line Interface – Ping

Pinging Internet connections and network devices can be an extremely useful first step when diagnosing network problems. Windows has a tool called Ping, which, as the title of this post suggests, is run from the command line. It is used to test the reliability of a host on an IP network, and to measure the time taken for messages sent from the originating computer to reach the destination host or network device.

You can ping using either a hostname, domain name, or IP address. For example, from a command line, type “ping google.com.” The response is shown below.

CLI-Ping1

Alternatively, you could just ping the IP address of a device on the network. In the example below I’m pinging my computers default gateway.

CLI-Ping2

So, what do all these result mean? Well, if we go through the first example where I pinged google.com, the results are below.

Pinging google.com [64.233.166.113] – Ping can only communicate with the IP address of the device, so the first thing it needs to do in the example above is do a DNS lookup on google.com. If this lookup were to fail you have either typed the domain name incorrectly or DNS is failing for some reason.

Reply from 64.233.166.113 – This tells you that the remote server or device on that IP address replied. It also verifies that all the equipment (routers & switches) between your device and the remote host also worked. If this failed, i.e. timed out, then this could indicate that a device between the two is broken, the remote server is down or does not exist, or the remote device is configured not to reply to pings.

Time=29ms – This is the round trip time, between sending a packet and receiving a response. The time can vary depending on the location of the remote server or device along with the number of routers and switches between you and the remote device.

Sent = 4, Received = 4, Lost = 0 – Ping sends multiple packets to the destination host, the default amount sent is 4. Ping reports on the success and failure rate of all packets sent.

Approximate round trip times – Ideally the same type of packet sent to the same destination should take around the same amount of time, however this is not always the case and depending on the number of devices and location of the remote server, some packets take longer than others. Ping reports these statistics.

Ping has a number of options or switches available, type ping /? at the command line for a full list of options. A couple I use on a regular basis are the –a & -t options.

Ping –a This option resolves the IP address to hostname. In the example below I have pinging 10.10.10.11 using the –a option, which queries DNS and returns the host name of LIV-MEM-SRV1. This is a really powerful option because it checks that DNS is working correctly along with all the usual connectivity checks of a normal ping.

CLI-Ping a

 

Ping –t This is one of the most useful options available. Ping the specified host or IP address until stopped. I often start a ping with this option before doing work on a remote server. If I have to reboot the server, this ping will give me accurate feedback on the state of the server, when its shut down, when its back on line. Use control C to terminate.

CLI-Ping t

So that’s the Ping command and how to use it, along with analysis of the results it reports.

Thanks for reading

TSP Admin