ICMP in IPv4 and IPv6 is used by intermediate or destination nodes to inform source nodes about problems and issues related to the delivery of datagrams. ICMP is also used for diagnostic purposes.
For example, in Figure 7.1, node A sends a datagram to B (step 1), but the router R1 cannot forward the datagram because B is unreachable. R1 sends an ICMP error message back to A (step 2), about the unreachability of B.
IPv6 ICMP [RFC4443] is similar to IPv4, but has a few enhancements:
An ICMP message is included in an IPv6 datagram by setting the Next Header field to 58, as shown in Figure 7.2. The ICMP header contains a type field which identifies the type of message. The code field further qualifies the specifics of the message. The next sections show the various type and code values and meanings. A checksum is computed (using a pseudo-header, as described in Section 19.1) because ICMP is a transport protocol, relative to IPv6.
When an ICMP message is sent ...