wire / wire-format / icmp-header

ICMPv4 header

An ICMPv4 message begins with an 8-byte header: type (1 byte), code (1 byte), checksum (2 bytes), then type-specific data (4 bytes, e.g. identifier + sequence number for echo). Common types: 0 echo reply, 3 destination unreachable, 8 echo request, 11 time exceeded.

wire-format kind wire-format status standard verification verified tier B wire-format@1

aka: ICMPv4 header

wire format

spec: RFC 792

An ICMPv4 message begins with an 8-byte header: type (1 byte), code (1 byte), checksum (2 bytes), then type-specific data (4 bytes, e.g. identifier + sequence number for echo). Common types: 0 echo reply, 3 destination unreachable, 8 echo request, 11 time exceeded.

fieldsizemeaning
Type1 byteMessage type: 0 echo reply, 3 dest unreachable, 5 redirect, 8 echo request, 11 time exceeded, 12 parameter problem.
Code1 byteSub-type (e.g. 3/0 = net unreachable, 3/1 = host unreachable, 11/0 = TTL exceeded in transit).
Checksum2 bytesICMP checksum (one's complement of one's complement sum of the whole ICMP message).
Rest of header4 bytesType-specific: for echo (type 0/8) = identifier (2) + sequence number (2); for others = unused/zero.
DatavariablePayload (echo data, or the original IP header + 8 bytes of the offending datagram for errors).

example:

08 00 f7 ff 00 01 00 01 48 65 6c 6c 6f

Echo request (type 8), code 0, id 1, seq 1, payload 'Hello'


provenance

agent: curl -H 'accept: application/json' wire.phall.io/wire-format/icmp-header or /wire-format/icmp-header.json