The Internet Control Message Protocol (ICMP) is part of the Internet protocol suite and defined in RFC 792. ICMP messages are typically generated in response to errors in IP datagrams (as specified in
RFC1122) or for diagnostic or routing purposes.
The current version of ICMP is also known as ICMPv4, as it is part of the Internet Protocol version 4.
Although ICMP messages are contained within standard IP datagrams, ICMP messages are usually processed as a special case distinguished from normal IP processing, rather than processed as a normal sub-protocol of IP.
In particular, ICMP messages should never be generated as a consequence of ICMP message processing, in order to prevent cascades of ICMP messages.
Many commonly used network utilities are based on ICMP messages.
The ping utility (well known on Unix) is implemented using the ICMP "Echo" and "Echo reply"
The related traceroute command is implemented by transmitting UDP datagrams
with manipulated IP Time-to-live (TTL) header fields and looking for ICMP "Time to
live exceeded in transit" and "Destination unreachable" messages in response.
Every machine (such as intermediate routers) that forwards an IP datagram has to decrement the TTL by one. If the TTL reaches 0, an ICMP "Time to live exceeded in transit" message is sent to the source of the datagram.
Each ICMP message is encapsulated directly within a single IP datagram
and thus, like UDP, ICMP does not guarantee delivery.