Groups Images Directory Web
Recently Visited Groups | Help | Sign in
Google Groups Home
Group info
Recent pages and files
What is ping? A short article.    
Ping is a command which uses IP address to sends a series of packets over a network or the Internet to a specific computer and that computer acknowledge the packet received. Ping was created to verify the network connectivity between two computers. But ping no longer remain reliable source for verifying network connectivity as a number of Internet Service Providers began filtering out ICMP Type 8 (echo request) messages at their network boundaries.

By default ping sends 64 bytes of data in one second interval, which is adjustable. Ping sends request in icmp type 8 and the response is received in icmp type 0. In Linux pings are send indefinitely until specified or stopped using ^C.

icmp has a 8 bit value space and there are about 255 possible value. 


I have explained the important options by giving separate examples.

Example 1:
The below example shows ping without any option. We pressed ctrl+c to stop further execution of ping as shown by ^c in below example.

[root@fedora10 ~]# ping 192.168.1.6
PING 192.168.1.6 (192.168.1.6) 56(84) bytes of data.
64 bytes from 192.168.1.6: icmp_seq=1 ttl=128 time=1.17 ms
64 bytes from 192.168.1.6: icmp_seq=2 ttl=128 time=0.275 ms
64 bytes from 192.168.1.6: icmp_seq=3 ttl=128 time=0.221 ms
64 bytes from 192.168.1.6: icmp_seq=4 ttl=128 time=0.063 ms
64 bytes from 192.168.1.6: icmp_seq=5 ttl=128 time=0.213 ms
64 bytes from 192.168.1.6: icmp_seq=6 ttl=128 time=0.284 ms
^C
--- 192.168.1.6 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5915ms
rtt min/avg/max/mdev = 0.063/0.372/1.178/0.367 ms
[root@fedora10 ~]#[/size]

The output above shows the results of making 6 pings to 192.168.1.6 with the results summarized at the end.

[*]shortest round trip time was 0.063 milliseconds
[*]average round trip time was 0.372 milliseconds
[*]maximum round trip time was 1.178 milliseconds
[*]Standard deviation of the round-trip time was 0.367 milliseconds

While a ping session is running, under Linux systems, you can get the overall status of the session without quitting by sending the Ctrl+\ key combination. This will give you a summary similar to the following shown below.

[sunil@fedora10 ~]$ ping 192.168.1.45
PING 192.168.1.45 (192.168.1.45) 56(84) bytes of data.
64 bytes from 192.168.1.45: icmp_seq=1 ttl=128 time=0.996 ms
64 bytes from 192.168.1.45: icmp_seq=2 ttl=128 time=0.277 ms
2/2 packets, 0% loss, min/avg/ewma/max = 0.277/0.636/0.906/0.996 ms  <~~~~~~
64 bytes from 192.168.1.45: icmp_seq=3 ttl=128 time=0.269 ms
64 bytes from 192.168.1.45: icmp_seq=4 ttl=128 time=0.239 ms
64 bytes from 192.168.1.45: icmp_seq=5 ttl=128 time=0.260 ms
5/5 packets, 0% loss, min/avg/ewma/max = 0.239/0.408/0.691/0.996 ms  <~~~~~~
64 bytes from 192.168.1.45: icmp_seq=6 ttl=128 time=0.284 ms
64 bytes from 192.168.1.45: icmp_seq=7 ttl=128 time=0.247 ms
64 bytes from 192.168.1.45: icmp_seq=8 ttl=128 time=0.264 ms
8/8 packets, 0% loss, min/avg/ewma/max = 0.239/0.354/0.550/0.996 ms  <~~~~~~
64 bytes from 192.168.1.45: icmp_seq=9 ttl=128 time=0.284 ms
64 bytes from 192.168.1.45: icmp_seq=10 ttl=128 time=0.258 ms
64 bytes from 192.168.1.45: icmp_seq=11 ttl=128 time=0.288 ms
^C
--- 192.168.1.45 ping statistics ---
11 packets transmitted, 11 received, 0% packet loss, time 10207ms
rtt min/avg/max/mdev = 0.239/0.333/0.996/0.210 ms
[sunil@fedora10 ~]$


Example 2:
You can also specify the number of ECHO_REQUEST packets to be send using -c option. The below example shows that when -c 3 is specified exactly 3 ECHO_REQUEST are sent to 192.168.1.6
[root@fedora10 ~]# ping -c 3 192.168.1.6
PING 192.168.1.6 (192.168.1.6) 56(84) bytes of data.
64 bytes from 192.168.1.6: icmp_seq=1 ttl=128 time=0.849 ms
64 bytes from 192.168.1.6: icmp_seq=2 ttl=128 time=0.245 ms
64 bytes from 192.168.1.6: icmp_seq=3 ttl=128 time=0.203 ms

--- 192.168.1.6 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 0.203/0.432/0.849/0.295 ms
[root@fedora10 ~]#


Example 3:
Some servers are configured to  not to respond to the ping sending large packets. You can specify the size of packets to be sent using -s option. The default is 56 bytes + 8 bytes of ICMP header data, which total comes to 64 bytes. In the below example we have specified the packet size of 24 with the number of ECHO_REQUEST packets to be send to 3. 24+8=32 thats why 32 bytes are being send on each ECHO_REQUEST.

[root@fedora10 ~]# ping -s 24 -c 3 192.168.1.6
PING 192.168.1.6 (192.168.1.6) 24(52) bytes of data.
32 bytes from 192.168.1.6: icmp_seq=1 ttl=128 time=0.236 ms
32 bytes from 192.168.1.6: icmp_seq=2 ttl=128 time=0.221 ms
32 bytes from 192.168.1.6: icmp_seq=3 ttl=128 time=0.236 ms

--- 192.168.1.6 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.221/0.231/0.236/0.007 ms
[root@fedora10 ~]#


Example 4:
We can also send the specific number of packets without waiting for the reply. This can be done using -l switch. The valid values is between 1 to 65536. Only the super-user may select preload more than 3.
[root@fedora10 ~]# ping -s 24 -l 55 192.168.1.6
PING 192.168.1.6 (192.168.1.6) 24(52) bytes of data.
32 bytes from 192.168.1.6: icmp_seq=1 ttl=128 time=0.580 ms
32 bytes from 192.168.1.6: icmp_seq=2 ttl=128 time=0.194 ms
32 bytes from 192.168.1.6: icmp_seq=3 ttl=128 time=0.217 ms

--- 192.168.1.6 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 0.194/0.330/0.580/0.177 ms
[root@fedora10 ~]#


Example 5:
ping can also send packets without displaying information each time it sends a packet using -q switch. When this switch is used nothing is displayed except the summary lines at startup time and when finished.
[root@fedora10 ~]# ping -c 3 -q 192.168.1.6
PING 192.168.1.6 (192.168.1.6) 56(84) bytes of data.

--- 192.168.1.6 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 0.220/0.228/0.242/0.019 ms
[root@fedora10 ~]#


This short article can also be read on http://opensourcenuts.com/fedora/ping.php

Version: 
1 message about this page
2 May 2009 by sunil datta
Click on http://groups.google.com/group/kgeclug/web/what-is-ping-a-short-article
- or copy & paste it into your browser's address bar if that doesn't
work.
Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google