This tutorial lists ICMP types and codes for both IP versions IPv4 and IPv6. Learn what ICMP message types and codes are and how they are categorized.
The IP protocol has no inbuilt mechanism to notify a source device if the packet sent by the source fails to reach the destination. For error reporting and controlling, it depends on the ICMP protocol. ICMP allows IP-enabled devices to send information and error messages.
ICMP is documented in RFC 792 and updated to RFC 1122, RFC 1812, RFC 1191, RFC 1256, and RFC 1393. ICMP is used for two different types of operations: reporting errors that prevent delivery and testing or debugging the network through the use of request and reply messages.
ICMP is a collection of predefined messages that represent specific conditions that may arise when an IP packet is transferred from a source to a destination in a network. Every ICMP message is assigned a unique "ICMP message type" which is simply a numeric value. Each ICMP message type represents a single predefined message or multiple messages. If multiple messages are associated with a single ICMP message type, they are defined by using another numeric value known as codes.
This tutorial is the second part of the article "ICMP (Internet Control Message Protocol) Explained through examples". Other parts of this article are the following.
A variety of predefined messages are available to choose from. A device can choose a message that describes the condition the device wants to inform or report to another device. ICMP provides separate sets of messages for IPv4 and IPv6.
ICMP message types and codes for IPv4
ICMP defines about 43 message types for IPv4 and reserves 44 -255 for future use. Only a couple of message types have sub-types. Sub-types are defined by using code values. We can categorize ICMP message types into the following three categories.
Error messages
These messages report an error and do not expect a response. These messages are used to inform the sender about a non-transient delivery problem.
Queries messages
These messages are sent with the expectation of a matching response. These are used to question conditions on the network. These messages are used in pairs, and each request anticipates a response.
Other messages
These messages are the messages they don't fall neatly into either category. These messages are typically used in specialized circumstances. These messages also include messages that have become obsolete and are no longer considered part of the standard dictionary of message types.
The following table lists all ICMP messages used with IPv4.
ICMP type | Description | Code | Category | Defined In |
0 | Echo Reply | 0 | Query | [RFC792] |
1 | Unassigned | NA | Other | NA |
2 | Unassigned | NA | Other | NA |
3 | Destination Unreachable | 0 - 15 | Error | [RFC792] |
4 | Source Quench (Deprecated) | NA | Error | [RFC792][RFC6633] |
5 | Redirect | 0 - 3 | Error | [RFC792] |
6 | Alternate Host Address (Deprecated) | NA | Other | [RFC6918] |
7 | Unassigned | NA | Other | NA |
8 | Echo | 0 | Query | [RFC792] |
9 | Router Advertisement | 0 | Other | [RFC1256] |
10 | Router Solicitation | 0 | Other | [RFC1256] |
11 | Time Exceeded | 0 - 1 | Error | [RFC792] |
12 | Parameter Problem | 0 -2 | Error | [RFC792] |
13 | Timestamp | 0 | Query | [RFC792] |
14 | Timestamp Reply | 0 | Query | [RFC792] |
15 | Information Request (Deprecated) | 0 | Query | [RFC792][RFC6918] |
16 | Information Reply (Deprecated) | 0 | Query | [RFC792][RFC6918] |
17 | Address Mask Request (Deprecated) | 0 | Query | [RFC950][RFC6918] |
18 | Address Mask Reply (Deprecated) | 0 | Query | [RFC950][RFC6918] |
19 | Reserved (for Security) | 0 | Other | [Solo] |
20-29 | Reserved (for Robustness Experiment) | NA | Other | [ZSu] |
30 | Traceroute (Deprecated) | NA | Other | [RFC1393][RFC6918] |
31 | Datagram Conversion Error (Deprecated) | NA | Other | [RFC1475][RFC6918] |
32 | Mobile Host Redirect (Deprecated) | NA | Other | [David_Johnson][RFC6918] |
33 | IPv6 Where-Are-You (Deprecated) | NA | Other | [Simpson][RFC6918] |
34 | IPv6 I-Am-Here (Deprecated) | NA | Other | [Simpson][RFC6918] |
35 | Mobile Registration Request (Deprecated) | NA | Other | [Simpson][RFC6918] |
36 | Mobile Registration Reply (Deprecated) | NA | Other | [Simpson][RFC6918] |
37 | Domain Name Request (Deprecated) | NA | Query | [RFC1788][RFC6918] |
38 | Domain Name Reply (Deprecated) | NA | Query | [RFC1788][RFC6918] |
39 | SKIP (Deprecated) | NA | Other | [Markson][RFC6918] |
40 | Photuris | 0 - 5 | Other | [RFC2521] |
41 | ICMP messages utilized by experimental mobility protocols such as Seamoby | NA | Other | [RFC4065] |
42 | Extended Echo Request | 0 - 255 | Query | [RFC8335] |
43 | Extended Echo Reply | 0 - 255 | Query | [RFC8335] |
44-252 | Unassigned | NA | Other | |
253 | RFC3692-style Experiment 1 | NA | Other | [RFC4727] |
254 | RFC3692-style Experiment 2 | NA | Other | [RFC4727] |
255 | Reserved | NA | Other |
Some messages type have sub-types. Sub-types are defined as codes. The following table lists all codes along with their types.
ICMP message Type | Code (ICMP message sub-type) | Description |
3 | 0 | Net Unreachable |
3 | 1 | Host Unreachable |
3 | 2 | Protocol Unreachable |
3 | 3 | Port Unreachable |
3 | 4 | Fragmentation Needed and Don't Fragment was Set |
3 | 5 | Source Route Failed |
3 | 6 | Destination Network Unknown |
3 | 7 | Destination Host Unknown |
3 | 8 | Source Host Isolated |
3 | 9 | Communication with Destination Network is Administratively Prohibited |
3 | 10 | Communication with Destination Host is Administratively Prohibited |
3 | 11 | Destination Network Unreachable for Type of Service |
3 | 12 | Destination Host Unreachable for Type of Service |
3 | 13 | Communication Administratively Prohibited |
3 | 14 | Host Precedence Violation |
3 | 15 | Precedence cutoff in effect |
5 | 0 | Redirect Datagram for the Network (or subnet) |
5 | 1 | Redirect Datagram for the Host |
5 | 2 | Redirect Datagram for the Type of Service and Network |
5 | 3 | Redirect Datagram for the Type of Service and Host |
9 | 0 | Normal router advertisement |
11 | 0 | Time to Live exceeded in Transit |
11 | 1 | Fragment Reassembly Time Exceeded |
12 | 0 | The Pointer indicates the error |
12 | 1 | Missing a Required Option |
12 | 2 | Bad Length |
40 | 0 | Bad SPI |
40 | 1 | Authentication Failed |
40 | 2 | Decompression Failed |
40 | 3 | Decryption Failed |
40 | 4 | Need Authentication |
40 | 5 | Need Authorization |
42 | 0 | No Error |
42 | 1-255 | Unassigned |
43 | 0 | No Error |
43 | 1 | Malformed Query |
43 | 2 | No Such Interface |
43 | 3 | No Such Table Entry |
43 | 4 | Multiple Interfaces Satisfy Query |
43 | 5-255 | Unassigned |
ICMP message types and codes for IPv6
IPv6 uses 256 ICMP messages. It divides them into two separate sets: error messages and information messages. For error messages, it uses a type value less than 128, and for information messages, it uses a type value greater than 128. In other words, type values 0 -127 are used for error messages, and type values 128 - 255 are used for information messages.
The following table lists all ICMP message types used with IPv6.
Type | description | RFC | code | Category |
0 | Reserved | NA | NA | Error |
1 | Destination Unreachable | [RFC4443] | 0 - 8 | Error |
2 | Packet Too Big | [RFC4443] | 0 | Error |
3 | Time Exceeded | [RFC4443] | 0 - 1 | Error |
4 | Parameter Problem | [RFC4443] | 0 - 10 | Error |
5 - 99 | Unassigned | NA | NA | Error |
100 | Private experimentation | [RFC4443] | NA | Error |
101 | Private experimentation | [RFC4443] | NA | Error |
102-126 | Unassigned | NA | NA | Error |
127 | Reserved for expansion of ICMPv6 error messages | [RFC4443] | NA | Error |
128 | Echo Request | [RFC4443] | 0 | Informational |
129 | Echo Reply | [RFC4443] | 0 | Informational |
130 | Multicast Listener Query | [RFC2710] | 0 | Informational |
131 | Multicast Listener Report | [RFC2710] | 0 | Informational |
132 | Multicast Listener Done | [RFC2710] | 0 | Informational |
133 | Router Solicitation | [RFC4861] | 0 | Informational |
134 | Router Advertisement | [RFC4861] | 0 | Informational |
135 | Neighbor Solicitation | [RFC4861] | 0 | Informational |
136 | Neighbor Advertisement | [RFC4861] | 0 | Informational |
137 | Redirect Message | [RFC4861] | 0 | Informational |
138 | Router Renumbering | [RFC2894] | 0-1 | Informational |
139 | ICMP Node Information Query | [RFC4620] | 0-2 | Informational |
140 | ICMP Node Information Response | [RFC4620] | 0-2 | Informational |
141 | Inverse Neighbor Discovery Solicitation Message | [RFC3122] | 0 | Informational |
142 | Inverse Neighbor Discovery Advertisement Message | [RFC3122] | 0 | Informational |
143 | Version 2 Multicast Listener Report | [RFC3810] | 0 | Informational |
144 | Home Agent Address Discovery Request Message | [RFC6275] | 0 | Informational |
145 | Home Agent Address Discovery Reply Message | [RFC6275] | 0 | Informational |
146 | Mobile Prefix Solicitation | [RFC6275] | 0 | Informational |
147 | Mobile Prefix Advertisement | [RFC6275] | 0 | Informational |
148 | Certification Path Solicitation Message | [RFC3971] | 0 | Informational |
149 | Certification Path Advertisement Message | [RFC3971] | 0 | Informational |
150 | ICMP messages utilized by experimental mobility protocols such as Seamoby | [RFC4065] | 0 | Informational |
151 | Multicast Router Advertisement | [RFC4286] | 0 | Informational |
152 | Multicast Router Solicitation | [RFC4286] | 0 | Informational |
153 | Multicast Router Termination | [RFC4286] | 0 | Informational |
154 | FMIPv6 Messages | [RFC5568] | 0 - 255 | Informational |
155 | RPL Control Message | [RFC6550] | 0 | Informational |
156 | ILNPv6 Locator Update Message | [RFC6743] | 0 | Informational |
157 | Duplicate Address Request | [RFC6775] | 0 - 15 | Informational |
158 | Duplicate Address Confirmation | [RFC6775] | 0 - 15 | Informational |
159 | MPL Control Message | [RFC7731] | NA | Informational |
160 | Extended Echo Request | [RFC8335] | 0 - 255 | Informational |
161 | Extended Echo Reply | [RFC8335] | 0-255 | Informational |
162-199 | Unassigned | NA | NA | Informational |
200 | Private experimentation | [RFC4443] | NA | Informational |
201 | Private experimentation | [RFC4443] | NA | Informational |
255 | Reserved for expansion of ICMPv6 informational messages | [RFC4443] | NA | Informational |
The following table lists ICMP message sub-types or codes.
ICMP Type | Code | Description |
1 | 0 | no route to the destination |
1 | 1 | communication with destination administratively prohibited |
1 | 2 | beyond scope of source address |
1 | 3 | address unreachable |
1 | 4 | port unreachable |
1 | 5 | source address failed ingress/egress policy |
1 | 6 | reject route to the destination |
1 | 7 | Error in Source Routing Header |
1 | 8 | Headers too long |
3 | 0 | hop limit exceeded in transit |
3 | 1 | fragment reassembly time exceeded |
4 | 0 | erroneous header field encountered |
4 | 1 | unrecognized Next Header type encountered |
4 | 2 | unrecognized IPv6 option encountered |
4 | 3 | IPv6 First Fragment has incomplete IPv6 Header Chain |
4 | 4 | SR Upper-layer Header Error |
4 | 5 | Unrecognized Next Header type encountered by the intermediate node |
4 | 6 | Extension header too big |
4 | 7 | Extension header chain too long |
4 | 8 | Too many extension headers |
4 | 9 | Too many options in the extension header |
4 | 10 | Option too big |
138 | 0 | Router Renumbering Command |
138 | 1 | Router Renumbering Result |
139 | 0 | The Data field contains an IPv6 address that is the subject of this query. |
139 | 1 | The Data field contains a name that is the subject of this query or is empty, as in the case of a NOOP. |
139 | 2 | The Data field contains an IPv4 address that is the subject of this query. |
140 | 0 | A successful reply. The Reply Data field may or may not be empty. |
140 | 1 | The Responder refuses to supply the answer. The Reply Data field will be empty. |
140 | 2 | The Qtype of the Query is unknown to the Responder. The Reply Data field will be empty |
154 | 0 | Reserved |
154 | 1 | Reserved |
154 | 2 | RtSolPr |
154 | 3 | PrRtAdv |
154 | 4 | HI - Deprecated (Unavailable for Assignment) |
154 | 5 | HAck - Deprecated (Unavailable for Assignment) |
154 | 6-255 | Unassigned |
157 | 0 | DAR message |
157 | 1 | EDAR message with 64-bit ROVR field |
157 | 2 | EDAR message with 128-bit ROVR field |
157 | 3 | EDAR message with 192-bit ROVR field |
157 | 4 | EDAR message with 256-bit ROVR field |
157 | 5-15 | Unassigned |
158 | 0 | DAC message |
158 | 1 | EDAC message with 64-bit ROVR field |
158 | 2 | EDAC message with 128-bit ROVR field |
158 | 3 | EDAC message with 192-bit ROVR field |
158 | 4 | EDAC message with 256-bit ROVR field |
158 | 5-15 | Unassigned |
160 | 0 | No Error |
160 | 1-255 | Unassigned |
161 | 0 | No Error |
161 | 1 | Malformed Query |
161 | 2 | No Such Interface |
161 | 3 | No Such Table Entry |
161 | 4 | Multiple Interfaces Satisfy Query |
161 | 5-255 | Unassigned |
That's all for this tutorial. In this tutorial, we discussed the ICMP message types and learned the meaning of ICMP message codes.