top of page

How Ping works ?


Ping is a program that is used to check the host reachability. It is very helpful in troubleshooting the IP networks. Let's take a quick look at ICMP packets used by Ping.

  1. Open terminal window on hostC1 and send 3 pings to hostA1 ping –c3 hostA1

  2. Observe the ping output.

  3. Observe the tcpdump output.

Results and Discussion:

Results:

Send 3 pings to hostA1 from hostC1

PING hostA1.test.ca (10.1.1.1): 56 data bytes

64 bytes from 10.1.1.1: icmp_seq=0 ttl=62 time=19.910 ms

64 bytes from 10.1.1.1: icmp_seq=1 ttl=62 time=23.077 ms

64 bytes from 10.1.1.1: icmp_seq=2 ttl=62 time=21.986 ms

--- hostA1.test.ca ping statistics ---

3 packets transmitted, 3 packets received, 0.0% packet loss

round-trip min/avg/max/stddev = 19.910/21.658/23.077/1.314 ms

tcpdump output:

tcpdump: listening on e0, link-type EN10MB (Ethernet), capture size 96 bytes

13:41:10.869429 IP (tos 0x0, ttl 64, id 54274, offset 0, flags [none], proto ICMP (1), length 84)

10.1.3.1 > 10.1.1.1: ICMP echo request, id 4107, seq 0, length 64

13:41:10.889335 IP (tos 0x0, ttl 62, id 54273, offset 0, flags [none], proto ICMP (1), length 84)

10.1.1.1 > 10.1.3.1: ICMP echo reply, id 4107, seq 0, length 64

13:41:11.879685 IP (tos 0x0, ttl 64, id 54275, offset 0, flags [none], proto ICMP (1), length 84)

10.1.3.1 > 10.1.1.1: ICMP echo request, id 4107, seq 1, length 64

13:41:11.902736 IP (tos 0x0, ttl 62, id 54274, offset 0, flags [none], proto ICMP (1), length 84)

10.1.1.1 > 10.1.3.1: ICMP echo reply, id 4107, seq 1, length 64

13:41:12.886893 IP (tos 0x0, ttl 64, id 54276, offset 0, flags [none], proto ICMP (1), length 84)

10.1.3.1 > 10.1.1.1: ICMP echo request, id 4107, seq 2, length 64

13:41:12.908855 IP (tos 0x0, ttl 62, id 54275, offset 0, flags [none], proto ICMP (1), length 84)

10.1.1.1 > 10.1.3.1: ICMP echo reply, id 4107, seq 2, length 64

Discussion:

Frame 2 contains the ICMP echo reply corresponding to frame 1 because the ID’s are the same and the sequence numbers are the same.

The RTT is calculated by storing the sending time as the data portion of the ICMP echo request. The data is copied into the ICMP echo reply.

The process repeats the frame 3, 4 and 5, 6. The sequence number increases by one each time.

bottom of page