ICMP
Also known as: Internet Control Message Protocol
The Internet Control Message Protocol — a companion protocol to IP used for diagnostic and error-reporting messages like ping and traceroute.
Last updated:
What is ICMP?
ICMP (Internet Control Message Protocol) is the diagnostic and error-reporting companion to IP. Unlike TCP and UDP, which carry application data, ICMP carries control messages — "destination unreachable", "time exceeded", "echo request/reply", and a few dozen other codes defined in RFC 792 (IPv4) and RFC 4443 (IPv6).
ICMP sits at the same layer as TCP and UDP (directly on top of IP), but it doesn't use ports. The full identity of an ICMP message is its type and code fields.
Tools that rely on ICMP
Two diagnostic tools every network engineer knows use ICMP as their core mechanism:
- ping — sends ICMP Echo Request (type 8) and measures how long the Echo Reply (type 0) takes to come back. A round-trip time of 20ms says the path is healthy; 2,000ms says something is very wrong
- traceroute — sends packets with gradually increasing TTL values. Each hop along the path returns an ICMP Time Exceeded (type 11), revealing the route
Important ICMP message types
| Type | Name | Purpose | |-----:|------|---------| | 0 | Echo Reply | Response to a ping | | 3 | Destination Unreachable | No route, port closed, host down | | 8 | Echo Request | Ping | | 11 | Time Exceeded | TTL reached 0 — used by traceroute | | 5 | Redirect | Router suggests a better path (often disabled for security) |
Why ICMP is often partially blocked
Operators frequently block ICMP at their firewalls, which breaks diagnostic tools but addresses real threats:
- Amplification attacks — spoofed pings to a broadcast address could trigger many replies aimed at the victim (the Smurf attack)
- Tunneling — attackers can exfiltrate data through ICMP payloads when other protocols are blocked
- Reconnaissance — attackers use ping sweeps to find live hosts on a network
The balance most operators settle on: allow Echo (ping), Time Exceeded (traceroute), and Destination Unreachable (essential for TCP/UDP error signaling — blocking it breaks Path MTU Discovery and causes mysterious hangs on large packets). Block the more exotic types.
ICMPv6 serves the same role on IPv6 but is much more important — it carries Neighbor Discovery and Router Solicitation, which replace ARP and DHCP. Blocking all ICMPv6 breaks IPv6 entirely.