Skip to content

Internet Control Message Protocol (ICMP) header

ICMP is a supporting protocol in the Internet protocol suite.

icmp

Type

  • ICMP type, see § Control messages.

Code

  • ICMP subtype, see § Control messages.

Checksum

  • Internet checksum (RFC 1071) for error checking, calculated from the ICMP header and data with value 0 substituted for this field.

Rest of header

  • In the four-byte field, contents vary based on the ICMP type and code.

Control messages

The value in the type field identifies control messages. The code field gives additional context information for the message.

Type Code Description
0 – Echo Reply 0 Echo reply
3 – Destination Unreachable 1 Destination network unreachable
3 – Destination Unreachable 2 Destination protocol unreachable
3 – Destination Unreachable 3 Destination port unreachable
5 – Redirect Message 0 Redirect Datagram for the Network
5 – Redirect Message 1 Redirect Datagram for the Host
8 – Echo Request 0 Echo request (used to ping)
11 – Time Exceeded 0 TTL expired in transit
11 – Time Exceeded 1 Fragment reassembly time exceeded
30 – Traceroute 0   Information Request

Redirect

Redirect requests data packets be sent on an alternative route. ICMP Redirect is a mechanism for routers to convey routing information to hosts.

Redirect

Time exceeded

Time Exceeded is generated by a gateway to inform the source of a discarded datagram due to the time to live field reaching zero. A host may also send a time-exceeded message if it fails to reassemble a fragmented datagram within its time limit.

The traceroute utility uses time-exceeded messages to identify gateways on the path between two hosts.