ICMP Echo Request and ICMP Echo Reply messages are used for network connectivity testing and troubleshooting purposes. If a person at a computer wants to test the Layer 3 network connectivity to another computer (located locally or remotely), he can use network troubleshooting tools like Ping, Traceroute/Tracert, Pathping etc., to generate and send ICMP Echo Request messages to other computer. When the other computer he was trying to troubleshoot the connectivity receives the ICMP Echo Request message, it will send back an ICMP Echo Reply message to the first computer.
Once the ICMP Echo Reply is received from the other computer we can make sure that Layer 3 connectivity exists between those two computers/hosts.
Format of ICMP Echo Request message and Echo Reply message is shown in below image.
As discussed in the ICMPv4 header lesson, ICMP Echo Request message has its Type as 8 and Code as 0. ICMP Echo Reply message has its Type as 0 and Code as 0. Note that the Code field in ICMP header has is same value for (0) ICMP Echo Request message and ICMP Echo Reply message. Please click next link to know more about Type and Code fields in ICMP header
The ID (Identifier) and the Sequence fields in ICMP Echo Request and Echo Reply messages are used to match a particular Echo Request with its corresponding Echo Reply.
Data payload of ICMP Echo Request packet is used for padding, using ASCII characters. ICMP Echo Reply packet must have the same data payload as the ICMP Echo request.
Screenshot of Wireshark packet capture of an ICMP Echo Request message is coiped below.
Screenshot of Wireshark packet capture of an ICMP Echo Reply message is coiped below.