ICMP is often considered part of the IP layer. It communicates error messages and other conditions that require attention. ICMP messages are usually acted on by either the IP layer or the higher layer protocol (TCP or UDP). Some ICMP messages cause errors to be returned to user processes.
ICMP messages are transmitted within IP datagrams, as shown in Figure 6.1.
Figure 6.1. ICMP messages encapsulated within an IP datagram.
RFC 792 [Postel 1981b] contains the official specification of ICMP.
Figure 6.2 shows the format of an ICMP message. The first 4 bytes have the same format for all messages, ...