What is ICMP?
ICMP is how the network talks about itself. Routers and hosts use it to send short notes back to a sender: this host is unreachable, this packet ran out of hops, this packet is too big. It rides directly inside IP and has no ports.
Two everyday tools are built on it. ping sends Echo requests and times the replies. traceroute uses Time exceeded notes to map every router on the path. IPv6 leans on ICMPv6 even more, for finding neighbours and routers.
Think of it like this. ICMP is the returned-mail notice of the internet. If a letter cannot be delivered, the post office sends a short note back saying why: no such address, or the letter was too big. Ping is like knocking on a door and waiting to hear someone knock back.
Step by step
Ping
3 stepsping sends an echo request; the server echoes it back, and the time it took is your round-trip time.
Ping
3 stepsping sends an echo request; the server echoes it back, and the time it took is your round-trip time.
- 1
Echo request
Type 8, sequence 1
ping builds an ICMP Echo request with an identifier and a sequence number, plus 56 bytes of filler. It notes the time it sent it.
- 2
Echo reply
Type 0, the same data back
The server's operating system answers by itself; no app is needed. The laptop matches the reply by identifier and sequence number and prints the time: about 36 ms here.
- 3
Repeat
One per second
ping keeps going, once a second on most systems. Missing sequence numbers show packet loss, and changing times show jitter.
Traceroute
4 stepsProbes with TTL 1, 2, 3 make each router on the path reply in turn, revealing the route hop by hop.
Traceroute
4 stepsProbes with TTL 1, 2, 3 make each router on the path reply in turn, revealing the route hop by hop.
- 1
Hop 1
TTL 1
traceroute sends a probe with TTL 1. The first router lowers it to 0, drops it and sends back Time exceeded. Its address is hop 1.
- 2
Hop 2
TTL 2
The next probe has TTL 2, so it dies one router further. Each hop is usually probed three times to show the time spread.
- 3
Hop 3
TTL 3
The core router reports in the same way. A hop that shows * * * just did not reply, which many routers are set to do. It does not mean the path is broken.
- 4
Destination
Echo reply ends it
With TTL 4 the probe reaches the server, which answers with an Echo reply instead. traceroute stops. Windows tracert always uses ICMP Echo; traceroute on macOS and Linux sends UDP by default, and -I switches to ICMP.
Host unreachable
3 stepsThe last router cannot find the machine on its network, so it sends Destination unreachable back.
Host unreachable
3 stepsThe last router cannot find the machine on its network, so it sends Destination unreachable back.
- 1
Ping a machine that is off
203.0.113.99
The packet crosses the internet fine, because the network 203.0.113.0/24 exists and is reachable.
- 2
Last hop fails
ARP gets no answer
The core router is directly connected to that network, so it asks for the machine's MAC address with ARP. Nobody answers.
- 3
Destination unreachable
Type 3, code 1
After a few seconds the router gives up and sends ICMP Destination unreachable, Host unreachable, to the sender. Windows ping shows: Reply from 192.0.2.1: Destination host unreachable. Code 0 would mean the whole network is unreachable; code 3 means the port is closed.
Ping blocked
3 stepsA firewall silently drops pings. ping says request timed out, yet the website works fine.
Ping blocked
3 stepsA firewall silently drops pings. ping says request timed out, yet the website works fine.
- 1
Ping sent
Echo requests leave
The laptop pings the server as usual.
- 2
Silence
Dropped by a firewall
The server's firewall is set to drop ICMP Echo requests without a word. ping waits about a second for each, then prints Request timed out.
- 3
Yet the site is up
TCP 443 still answers
A TCP connection to port 443 gets its SYN-ACK at once. A failed ping only means pings are blocked, not that the server is down.
Myths and mix-ups
- A failed ping does not mean a server is down; many servers and firewalls drop pings on purpose.
- Blocking all ICMP is not good security; it breaks path MTU discovery and makes problems harder to find.
- ICMP does not use ports; a ping to port 80 is not a thing.
- Stars (* * *) in traceroute do not mean the path is broken; that router just did not answer the probe.
Try it yourself
Run these on your own computer to see ICMP at work.
Ping four times (Windows)
ping example.comWindows sends four by default. Look at time= and the loss percentage.
Ping four times (macOS or Linux)
ping -c 4 example.comWithout -c it runs until you press Ctrl+C.
Trace the path (Windows)
tracert example.comEach line is one router, probed three times with ICMP Echo.
Trace the path (macOS or Linux)
traceroute example.comSends UDP probes by default. Add -I for ICMP (may need sudo on Linux).
Watch ICMP live (macOS or Linux)
sudo tcpdump -n icmpRun ping in another terminal to see each request and reply.
ICMP at a glance
- Layer
- Network (3), carried inside IP
- IP protocol number
- 1 (ICMPv6 is 58)
- Ports
- None
- Common types
- 0 Echo reply, 3 Unreachable, 8 Echo request, 11 Time exceeded
- Header
- 8 bytes: type, code, checksum, then type-specific fields
- Defined in
- RFC 792 (1981); ICMPv6 in RFC 4443
Defined inRFC 792RFC 4443RFC 1191RFC 1812
Header fields
What ICMP puts in its messages, with example values from the stories above.
ICMP
- Type
8 (Echo request)8 asks: are you there? Please echo this back.- Code
0- Checksum
verified- Identifier
0x1a2bPicked by the ping program, so replies reach the right window.- Sequence number
1Goes up by one each ping, so you can spot a missing reply.- Data
56 bytesFiller that the target copies back unchanged.- Original packet
IPv4 header + 8 bytes of the probe with TTL 1Lets traceroute match this note to the probe it sent.
Test yourself
Which ICMP type is an Echo request?
Questions people ask
What is ICMP used for?
Sending error and status notes about IP delivery, such as host unreachable, time exceeded and packet too big. The ping and traceroute tools are built on it.
Why does ping say request timed out?
No reply came back within about a second. The host may be down, but often a firewall simply drops pings, or a reply was lost on a busy link.
What does TTL mean in ping results?
The time to live left on the reply when it arrived. Hosts usually start at 64 or 128 and each router lowers it by one, so it hints at how many hops away the host is.
Should I block ICMP on my firewall?
Not all of it. Blocking Echo requests from outside is common, but Destination unreachable, Time exceeded and Packet Too Big are needed for the network to work properly.
What is the difference between ping and traceroute?
ping tests whether one host answers and how fast. traceroute shows every router on the way to it and the time to each one.