wire / wire-format / icmp-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.
aka: ICMPv4 header
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.
| field | size | meaning |
|---|---|---|
| Type | 1 byte | Message type: 0 echo reply, 3 dest unreachable, 5 redirect, 8 echo request, 11 time exceeded, 12 parameter problem. |
| Code | 1 byte | Sub-type (e.g. 3/0 = net unreachable, 3/1 = host unreachable, 11/0 = TTL exceeded in transit). |
| Checksum | 2 bytes | ICMP checksum (one's complement of one's complement sum of the whole ICMP message). |
| Rest of header | 4 bytes | Type-specific: for echo (type 0/8) = identifier (2) + sequence number (2); for others = unused/zero. |
| Data | variable | Payload (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'
agent: curl -H 'accept: application/json' wire.phall.io/wire-format/icmp-header
or /wire-format/icmp-header.json