The software in turn is required to send the echo reply message. When a router has an ICMP message to send, it creates an IP datagram and encapsulates the ICMP message in the datagram. The router sends the ICMP message back to the source of the datagram. The ping program tests to see if a given destination can be reached by sending a datagram to the specified destination and waiting for a reply. Ping sends a datagram that contains an ICMP echo request message to the destination which sends an ICMP echo reply.
Ping transmits the message twice.
Using ICMP to Trace a Route Traceroute uses the ICMP time exceeded messages to find a list of all routers along a path to a given destination. It sends a series of datagrams and waits a response to each. Traceroute becomes problematic when datagrams are lost, duplicated, or delivered out of order. The smallest MTU along a path from source to destination is called path MTU . IP software on a host sends a sequence of probes where each probe consists of a datagram that has the header bit set to prevent fragmentation.