Chapter 4. ICMPv6

If you are familiar with IPv4, the Internet Control Message Protocol (ICMP) for IPv4 is probably a good friend of yours: it gives important information about the health of the network. ICMPv6 is the version that works with IPv6. It reports errors if packets cannot be processed properly and sends informational messages about the status of the network. For example, if a router cannot forward a packet because it is too large to be sent out on another network, it sends back an ICMP message to the originating host. The source host can use this ICMP message to determine a better packet size and then resend the data. ICMP also performs diagnostic functions, such as the well-known ping, which uses ICMP Echo Request and Echo Reply messages to test availability of a node.

ICMPv6 is much more powerful than ICMPv4 and contains new functionality, as described in this chapter. For instance, the Internet Group Management Protocol (IGMP) function that manages multicast group memberships with IPv4 has been incorporated into ICMPv6. The same is true for the Address Resolution Protocol/Reverse Address Resolution Protocol (ARP/RARP) function that is used in IPv4 to map layer 2 addresses to IP addresses (and vice versa). Neighbor discovery (ND) is introduced; it uses ICMPv6 messages in order to determine link-layer addresses for neighbors attached to the same link, to find routers, to keep track of which neighbors are reachable, and to detect changed link-layer addresses. ICMPv6 also supports Mobile IPv6, which is described in Chapter 7. ICMPv6 is part of IPv6 and it must be implemented fully by every IPv6 node. It is defined in RFC 2463 (obsoletes RFC 1885). Neighbor discovery is defined in RFC 2461 (obsoletes RFC 1970).

General Message Format

There are two classes of ICMP messages:

ICMP error messages

Error messages have a zero in the high-order bit of their message Type field. ICMP error message types are therefore in the range 0 to 127.

ICMP informational messages

Informational messages have a one in the high-order bit of their message Type field. ICMP informational message types are therefore in the range 128 to 255.

An IPv6 header and zero or more extension headers precede every ICMPv6 message. The header just preceding the ICMP header has a next header value of 58. This value is different from the value for ICMPv4 (which has the value 1).

Tip

The values for the next header field are discussed in Chapter 2.

The following message types are described in RFC 2463:

  • ICMPv6 error messages

    • Destination Unreachable (message type 1)

    • Packet Too Big (message type 2)

    • Time Exceeded (message type 3)

    • Parameter Problem (message type 4)

  • ICMPv6 informational messages

    • Echo Request (message type 128)

    • Echo Reply (message type 129)

Tip

For the most current list of ICMPv6 message types, refer to the Internet Assigned Number Authority (IANA) at http://www.iana.org/assignments/icmpv6-parameters. All IPv4 ICMP parameters can be found at http://www.iana.org/assignments/icmp-parameters.

All ICMPv6 messages have the same general header structure, shown in Figure 4-1. Notice that the first three fields for type, code, and checksum have not changed from ICMPv4.

General ICMPv6 header format

Figure 4-1. General ICMPv6 header format

Type (1 Byte)

This field specifies the type of message, which determines the format of the remainder of the message. Table 4-1 and Table 4-2 list ICMPv6 message types and message numbers.

Code (1 Byte)

The Code field depends on the message type and allows for more granular information in certain cases. Refer to Table 4-1 and Table 4-2 for a detailed list.

Checksum (2 Bytes)

The Checksum field is used to detect data corruption in the ICMPv6 header and in parts of the IPv6 header. In order to calculate the checksum, a node must determine the source and destination address in the IPv6 header. If the node has more than one unicast address, there are rules for choosing the address (refer to RFC 2463 for details). There is also a pseudoheader included in the checksum calculation, which is new with ICMPv6.

Message Body (Variable Size)

Depending on the type and code, the message body will hold different data. In the case of an error message, it will contain as much as possible of the packet that invoked the message to assist in troubleshooting. The total size of the ICMPv6 packet should not exceed the minimum IPv6 MTU, which is 1280 bytes. Table 4-1 and Table 4-2 provide an overview of the different message types, along with the additional code information, which depends on the message type.

Table 4-1. ICMPv6 error messages and code types

Message number

Message type

Code field

1

Destination Unreachable

0 = no route to destination

1 = communication with destination administratively prohibited

2 = beyond scope of source address (draft)

3 = address unreachable

4 = port unreachable

2

Packet Too Big

Code field set to 0 (zero) by the sender and ignored by the receiver

3

Time Exceeded

0 = hop limit exceeded in transit

1 = fragment reassembly time exceeded

4

Parameter Problem

0 = erroneous header field encountered

1 = unrecognized next header type encountered

2 = unrecognized IPv6 option encountered

The pointer field identifies the octet offset within the invoking packet where the error was detected. The pointer points beyond the end of the ICMPv6 packet if the field in error is beyond what can fit in the maximum size of an ICMPv6 error message.

Note that the message numbers and types have substantially changed compared to ICMPv4. ICMP for IPv6 is a different protocol, and the two versions of ICMP are not compatible. Your analyzer should properly decode all this information, so you do not have to worry memorizing it.

Table 4-2. ICMPv6 informational messages

Message number

Message type

Description

128

129

Echo Request

Echo Reply

RFC 2463. Both used for the ping command.

130

131

132

Multicast Listener Query

Multicast Listener Report

Multicast Listener Done

RFC 2710. Used for multicast goup management (IPv4 uses IGMP for this functionality).

133

134

135

136

137

Router Solicitation

Router Advertisement

Neighbor Solicitation

Neighbor Advertisement

Redirect Message

RFC 2461. Used for neighbor discovery and autoconfiguration.

138

139

140

Router Renumbering

ICMP Node Information Query

ICMP Node Information Response

RFC 2894

Draft number at the time of writing: http://www.ietf.org/internet-drafts/draft-ietf-ipngwg-icmp-name-lookups-09.txt.

141

142

Inverse ND Solicitation

Inverse ND Adv Message

RFC 3122

RFC 3122

150

151

152

153

ICMP Home Agent Address Discovery Request Message

ICMP Home Agent Address Discovery Reply Message

ICMP Mobile Prefix Solicitation Message Format

ICMP Mobile Prefix Advertisement Message Format

Experimental / Draft—ICMPv6 Messages for Mobile IPv6

Draft number at time of writing: http://www.ietf.org/internet-drafts/draft-ietf-mobileip-ipv6-18.txt.

Message numbers have not yet been assigned by IANA.

Get IPv6 Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.