Ping is a computer network administration utility used to test the reachability of a host on an Internet Protocol (IP) network and to measure the round-trip time for messages sent from the originating host to a destination computer.
To increase or decrease the time interval between packets :
By default the time interval between two packets in Ping is 1 sec. It can be altered by using “–i” option
Increase time interval (wait for 4 sec.) :
# ping -i 4 [IP]
Decrease time interval (wait for 0.1 sec.) :
# ping -i 0.1 [IP]
Note: only super user can specify interval less than 0.2 sec.
To Ping the localhost :
Three methods to check the local network interface status :
# ping 0
# ping localhost
# ping 127.0.0.1
To specify the no. of packets to be sent :
The specified no. of packets are sent and then the Ping stops.
# ping -c [no.] [IP]
Eg. # ping -c 5 192.168.7.1
To flood the network :
Super users can flood a host with packets. It prints a “.” when a packet is sent and a backspace is printed when a packet is received.
# ping -f [IP]
To print only Ping command summary statistics :
If you only want to view the Ping statistics and not each reply, then :
# ping -q [IP]
You can also specify the no. of packets here :
# ping -c 7 -q [IP]
To change the Ping packet size :
# ping -s [size] [IP]
Eg. # ping -s 200 192.168.7.1
To specify the timeout :
You can specify the no. of seconds the Ping command should send the packets :
# ping -w [time] [IP]
Eg. # ping -w 6 192.168.7.1
This will send ping for 6 sec.
Note: if you specify both “-w” and “-c”, then whichever comes first will terminate the Ping.
To view the shorter statistics :
If you want to view the shorter statistics, while Ping is printing individual packet status :
Press CTRL + | (control key + pipe symbol). It prints the short statistics while Ping is still continued.
To record and print the route of Ping :
It records and prints the network route through which the packet is sent and received
# ping -R [IP]
To stop your System from responding to Ping :
Write this at the terminal :
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
Now, your system will not respond to any ping received from any other system.
To revert :
echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all