ICMP, the Internet Control Message Protocol, is a network-layer protocol that routers and hosts use to report errors and share operational information about IP traffic, such as a destination being unreachable or a packet's time to live expiring. It carries no user data and has no ports. It powers ping and traceroute, and it is defined for IPv4 in RFC 792 and for IPv6 in RFC 4443.
Key takeaways
- ICMP reports errors and diagnostics for IP traffic; it does not carry user data and has no ports.
- Ping uses ICMP echo request and reply, while traceroute uses time-exceeded messages to map each hop.
- ICMP can be abused for floods and reconnaissance, so allow the types you need and rate-limit the rest.
When a packet vanishes on the internet, something has to explain why. That job belongs to ICMP, the Internet Control Message Protocol. It is the quiet messenger behind ping, traceroute and the "destination unreachable" errors network engineers see every day.
What is ICMP?
ICMP is a network-layer protocol that routers and hosts use to report errors and exchange operational information about IP traffic. It tells the sender when a destination cannot be reached, when a packet expired, or when fragmentation is needed.
IP itself is deliberately simple: it delivers packets on a best-effort basis and, as RFC 792 puts it, is "not designed to be absolutely reliable." ICMP exists to provide feedback about problems in that delivery, not to make IP reliable. Higher-level protocols must add their own reliability if they need it.
ICMP is an integral part of IP and must be implemented by every IP module, according to RFC 792. It travels inside IP packets, using protocol number 1 for IPv4, but it is not a transport protocol: it carries no user data and has no ports.
How does ICMP work?
When a router or host cannot deliver a packet, it builds an ICMP message, wraps it in a new IP packet, and sends it back to the source address of the original packet. The message includes the IP header and the first 64 bits of the original datagram, so the sender can match the error to the packet that caused it.
Every ICMP message has a type and a code. The type says what happened in general terms, and the code adds detail. A checksum protects the message, and the remaining fields depend on the type. To avoid an endless loop of messages about messages, no ICMP message is ever sent about another ICMP message.
A common example is the time-to-live (TTL) field. Each router decrements TTL by one as it forwards a packet. If TTL reaches zero, the router discards the packet and may send an ICMP time-exceeded message to the source. That mechanism is what makes traceroute possible.
What are the main ICMP message types?
The most common ICMP types are echo request and reply, destination unreachable, time exceeded, redirect, and parameter problem. Error messages report a failure; informational messages, such as echo, are queries and replies used for diagnostics.
| Type | Name | What it means | Everyday use |
|---|---|---|---|
| 0 | Echo reply | Answer to an echo request | Ping response |
| 3 | Destination unreachable | Network, host, protocol or port cannot be reached | Diagnosing a dead route or closed service |
| 5 | Redirect | Use a different router for this destination | Routing optimisation on a local network |
| 8 | Echo request | Please reply if you are reachable | Ping |
| 11 | Time exceeded | TTL hit zero in transit, or reassembly timed out | Traceroute |
| 12 | Parameter problem | An error was found in the IP header | Debugging malformed packets |
Destination unreachable is the most detailed type. Its codes distinguish a network being unreachable (code 0), a host being unreachable (code 1), and fragmentation being needed while the Don't Fragment flag is set (code 4). That last code is central to path MTU discovery, as Versa Networks' ICMP guide explains: it tells the sender to send smaller packets.
How do ping and traceroute use ICMP?
Ping sends an ICMP echo request (type 8) and waits for an echo reply (type 0). The round-trip time tells you whether the host is reachable and how long packets take. Traceroute sends packets with increasing TTL values and records the time-exceeded messages from each router along the path.
Ping is a connectivity and latency test, not a service test. A host can answer ping while its web server is down, and it can ignore ping while serving web pages normally. Use ping to check the path, then test the actual service — for example, check whether the site loads over HTTPS — before drawing conclusions.
On Windows, run ping example.com and tracert example.com. On macOS and Linux, use ping example.com and traceroute example.com. A "request timed out" reply usually means ICMP is filtered or the host is silent, not necessarily that it is offline. You can cross-check a domain's DNS and reachability with our free DNS lookup tool.
ICMP vs TCP vs UDP: what's the difference?
ICMP, TCP and UDP all sit close together in the protocol stack, but they do different jobs. TCP and UDP are transport protocols that carry application data between ports. ICMP carries operational messages about IP delivery itself and has no ports at all.
| Feature | ICMP | TCP | UDP |
|---|---|---|---|
| Layer | Network (layer 3) | Transport (layer 4) | Transport (layer 4) |
| Carries user data? | No | Yes | Yes |
| Ports? | No — type and code | Yes | Yes |
| Connection? | Connectionless | Connection-oriented | Connectionless |
| Reliability | Best effort, no guarantees | Reliable, ordered, retransmitted | Best effort, no guarantees |
| Main use | Errors and diagnostics | Web, email, file transfer | DNS, video, gaming |
Think of it this way: TCP and UDP are the delivery vans carrying your parcels, while ICMP is the courier's note that says "the address does not exist" or "the parcel was too big for this route." You can learn more about the transport layer in our guide to securing your Wi-Fi network, where the same layered thinking applies to home networks.
What is ICMPv6 and why does IPv6 need it more?
ICMPv6, defined in RFC 4443, is the ICMP version used with IPv6, using IP protocol number 58. It handles the same error reporting and diagnostics as ICMPv4, but it also absorbs jobs that IPv4 handled with separate protocols.
The two biggest additions are neighbor discovery and stateless address autoconfiguration. Neighbor discovery replaces ARP: hosts use ICMPv6 messages to find each other on a local network, learn router addresses, and detect duplicate addresses. Autoconfiguration lets a device build its own IPv6 address from router advertisements, with no DHCP server required.
That makes ICMPv6 far harder to block safely than ICMPv4. Blocking all ICMPv6 can break basic IPv6 connectivity on a network, including address assignment itself. Firewalls should filter ICMPv6 by type, allowing neighbor discovery and essential error messages while blocking the rest.
How is ICMP abused in attacks?
ICMP's simplicity makes it useful to attackers. The main abuses are floods, amplification, tunneling, and reconnaissance. None of them requires a vulnerability in ICMP itself — they exploit the fact that hosts answer ICMP by default.
- Ping flood: an attacker sends a huge volume of echo requests to overwhelm a target's bandwidth or processing capacity.
- Smurf attack: echo requests are sent to a network's broadcast address with the victim's address spoofed as the source, so every host on that network replies to the victim at once.
- ICMP tunneling: data is hidden inside the payload of echo packets to smuggle information past firewalls that allow ping.
- Reconnaissance: ping sweeps and traceroute map which hosts are live and reveal network topology before a larger attack.
- Redirect abuse: forged redirect messages can steer traffic through an attacker's router on a local network.
Modern networks blunt these attacks with rate limiting on ICMP, by disabling directed broadcasts on routers, and by ignoring ICMP redirects from untrusted sources. A Smurf attack today is largely a historical concern, because routers now drop directed broadcasts by default, but floods and tunneling still appear in incident reports.
Should you block ICMP? How to configure it safely
Blocking all ICMP is a common mistake. It breaks path MTU discovery, which relies on destination-unreachable code 4, and it removes the diagnostics that make outages faster to fix. The better approach is to allow what you need and rate-limit the rest.
For a typical small business, allow inbound echo reply, destination unreachable, time exceeded, and packet-too-big messages, and allow outbound echo request so staff can run ping. Block or rate-limit large volumes of echo requests from the internet, and log unusual ICMP spikes — they can be an early sign of a flood or a scan.
On a home router, leave the default ICMP handling alone unless you have a specific reason to change it. If you run a public server, test it after any firewall change: confirm that ping works from inside your network, that path MTU discovery still functions, and that traceroute reaches the server. If you want to check what the internet sees about your connection, start with our what is my IP tool.
The bottom line
ICMP is the internet's error-reporting system: no user data, no ports, no connections — just short, specific messages that explain what went wrong with a packet. Ping and traceroute are the tools most people meet first, but the protocol also keeps path MTU discovery and IPv6 networking working.
Allow the ICMP types your network needs, rate-limit the rest, and treat a failed ping as a clue rather than a verdict. You can check a site's basic reachability and security posture with the free SSL checker.
Frequently asked questions
What is ICMP in simple terms?
ICMP is the internet's way of reporting problems. When a router cannot deliver a packet, or a packet expires on its journey, ICMP sends a short message back to the sender explaining what happened, instead of the packet simply disappearing.
What is ICMP used for?
ICMP is used for error reporting and network diagnostics. Its best-known uses are ping, which tests whether a host is reachable, and traceroute, which maps the routers between you and a destination. It also reports destination-unreachable and fragmentation problems.
Does ICMP use a port?
No. ICMP has no ports because it is not a transport-layer protocol like TCP or UDP. ICMP messages travel inside IP packets, identified by IP protocol number 1 for IPv4 and 58 for ICMPv6, and are identified by type and code numbers instead of ports.
What is the difference between ICMP and TCP?
TCP is a transport protocol that carries application data reliably between ports, with connections, sequencing and retransmission. ICMP carries no user data and makes no connection; it only reports errors and operational information about IP delivery itself.
Is ICMP safe to allow through a firewall?
It is safe to allow the ICMP types you need, such as echo request and reply for ping, destination unreachable, and time exceeded. Blocking all ICMP breaks path MTU discovery and useful diagnostics. Most networks allow selected types and rate-limit the rest.
What is ICMPv6?
ICMPv6 is the version of ICMP used with IPv6, defined in RFC 4443. It does everything ICMPv4 does, and it also handles neighbor discovery and stateless address autoconfiguration, jobs that IPv4 handled with separate protocols such as ARP.
Why does ping fail even when a website works?
Many servers and firewalls block ICMP echo requests while still serving web traffic over TCP. A failed ping therefore does not prove a host is down; it often only proves that ICMP is filtered. Test the actual service, such as HTTPS on port 443, before concluding the host is unreachable.
Can ICMP be used in attacks?
Yes. Attackers abuse ICMP in ping floods, Smurf attacks that amplify replies, ICMP tunneling to smuggle data, and reconnaissance scans that map live hosts. Rate limiting, blocking directed broadcasts, and monitoring for unusual ICMP volumes reduce the risk.
Sources
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against RFC 792 for ICMPv4 and RFC 4443 for ICMPv6, plus vendor documentation from Versa Networks and Okta.
How we write and fact-check →