Ping It!

All the network and IT professionals need to be familiar with the ping command, so hopefully today’s article will teach you something new about it and its best practices.

The name PING actually comes from active sonar terminology that sends a pulse of sound and listens for the echo to detect objects underwater, though sometimes it’s interpreted as a backronym to Packet InterNet Groper.

Ping is usually measured in milliseconds (ms), and It’s the main troubleshooting technique for an IP network used to find out whether the host or gateway is reachable or not. It will also calculate the RTT (Round Trip Time) for the packet to reach its destination.

I am using UBUNTU 14.04.03 LTS Linux OS here to show you some ping examples, but this will work on any other Linux distro you have.

Check Ping Version

Open terminal and write the following command

ping -V

It will return the currently installed ping version on your system.

Simple Ping Test  

The ping command takes only one parameter: hostname or host IP address. To check this simply open terminal and type the following command


To stop the ping you need to press CTRL+C in Linux. Without doing so, it will ping for indefinitely which can be useful if you’re trying to find the rate of packet loss and don’t know the average rate ahead of time.  After execution of every ping command, it will display a summary report with following outputs.

min: it will show minimum time taken to get a response from host that is pinged from your side.

avg: it will show average time taken to get a response from host that is pinged from your side.

max: it will show maximum time taken to get a response from host that is pinged from your side.

mdev: this is the moving standard deviation, sometimes also abbreviated "MSTD".

Also there is a TTL field which stands for Time to Live. It is also known as hop count.

Ping Counts

As in the previous example, using the ping command without passing any parameters will ping infinitely on Linux. Fortunately you can define the count limit for ping command. The command is as follows:

ping -c 6



Change the Time interval of Ping Command

By default, ping waits for 1 second before sending the next packet towards the destination host. You can change this time by using parameter -i. If you, for example, want to change time from 1 second to 5 seconds, the command will look like this:

ping -i 5

If you want to decrease the time interval, this is the command

ping -i 0.4

Changing Packet Size

The ping command sends 64 bytes request to a host by default, where 56 bytes are data along with 8 bytes of ICMP header. If you want to change the sizes of packets then you can use this command like so

ping -s 200 -c 2

Flood Test

Flooding is to test the network performance and send packets as soon as possible. Here’s the command

ping -f

To stop flooding, use the CTRL+C command as this flooding will also run indefinitely if it’s not stopped manually.

Summary Statistics

If you want, you can actually get a  summary statistics report without seeing the ping requests execution in terminal. This is the command:

ping -c 4 -q

Timeout Responses

To specify ping response while setting time limit you can use the -w parameter. This is the command:

ping -w 3

As you can see, the ping command terminates after 3 packets like we specified.

Ping outputs Explanations

“Destination Net Unreachable” - if you see “Destination Net Unreachable” it means that your server can't route traffic to the specified network or some other router located after your gateway can't do the same. You can consider check your routing table first, and then use the 'traceroute' command for troubleshooting in this situation.
“Destination Host Unreachable” - that means there’s no route to this host, whether due to an incorrect address, or the host is offline/drops your requests.
“Unknown Host” - most likely means that you misspelled in your domain name when write it.

That about does it for the ping command. Ping is a very simple tool, but it has a vast number of uses when it comes to troubleshooting network issues so it's pretty important to know about. If you have any questions about this article, or any other article we post for that matter, feel free to hit us up on @serversuit, comment on Facebook! Watch out for our articles released regularly from ServerSuit

Until next time! 

June 20 2016

Add or review comments

Please leave your comment

Existing comments

Comments 1

Scenario: In case I need a set of IP to ping in one of my workstation. I can have as many as possible instances of my workstation and having the same IP set with the connected devices. I need to ping test on all the devices How to terninate in case one of the IP is unreachable as it might take long time to terminate with -c or -w flags? any idea. e.g. a shell file having ping -c 10000 -i 0.01 -s 200 <IP1> ping -c 10000 -i 0.01 -s 200 <IP2> ... ping -c 10000 -i 0.01 -s 200 <IPn> And the IP2 is not reachable it with waste a big time on the IP2. Can we avoid/bypass it.