ICMP Error Messages: Unreachable, Packet Too Big, Redirect, Time Exceeded and Parameter Problem
Every common ICMPv4 and ICMPv6 error, triggered in a lab and captured: net, host, port and protocol unreachable, prohibited and blackhole routes, Packet Too Big, redirects, TTL and reassembly timeouts, parameter problems, what applications see, and ICMP extensions.
kvi5hnuCode Sprout team member18 min readOn this page
Article 39 covered what all ICMP messages share and when errors may be sent. This article goes through the error messages one by one. Each was triggered deliberately in a lab and captured. Most come from a router on the path, and a few from the destination itself:

The lab network has a client (192.0.2.10, 2001:db8:1::10) and two routers, r1 (192.0.2.1) and r2 (192.0.2.2), sharing one LAN. r1 connects to a server network, 198.51.100.0/24 and 2001:db8:2::/64. Each section shows what ping or the application reported, then the type and code of the ICMP message the client received, decoded from a capture.
Destination Unreachable
Destination Unreachable is ICMPv4 type 3 and ICMPv6 type 1. The Code says why the packet couldn't be delivered. ICMPv4 defines 16 codes, most of them historic. RFC 4443 gave ICMPv6 seven (0 to 6), and later RFCs added two more for specialized cases.
No route: net unreachable
When a router has no route at all for the destination, it sends net unreachable (ICMPv4 code 0) or no route to destination (ICMPv6 code 0). The lab's r1 has no default route, so anything outside its connected networks gets this:
From 192.0.2.1 icmp_seq=1 Destination Net Unreachable
From 2001:db8:1::1 icmp_seq=1 Destination unreachable: No route
ICMPv4 from 192.0.2.1 type 3 code 0 net unreachable
ICMPv6 from 2001:db8:1::1 type 1 code 0 no route to destination
Final delivery fails: host or address unreachable
When a router has a route, and the destination is on a directly connected network, it still needs the host's link-layer address. If ARP (article 21) or neighbor discovery (article 42) gets no answer, the router gives up after a few seconds and sends host unreachable (ICMPv4 code 1) or address unreachable (ICMPv6 code 3). In the lab, 198.51.100.77 and 2001:db8:2::77 are on the server's network but don't exist:
From 192.0.2.1 icmp_seq=1 Destination Host Unreachable
From 2001:db8:1::1 icmp_seq=1 Destination unreachable: Address unreachable
ICMPv4 from 192.0.2.1 type 3 code 1 host unreachable
ICMPv6 from 2001:db8:1::1 type 1 code 3 address unreachable
This one takes a few seconds to arrive, because the router waits for its address resolution attempts to fail first.
Special routes: unreachable, prohibit and blackhole
Routers can also have routes whose whole job is to reject traffic. They're used to stop packets to unused or forbidden prefixes from going anywhere, for example "martian" addresses that should never appear on the Internet, or prefixes that aren't allocated yet ("bogons"). Linux has three kinds:
unreachablesends an error;prohibitsends an "administratively prohibited" error;blackholedrops silently.
The lab installed one of each on r1:
unreachable 203.0.113.0/26
prohibit 203.0.113.64/26
blackhole 203.0.113.128/26
ping 203.0.113.5 -> From 192.0.2.1 icmp_seq=1 Destination Host Unreachable
ping 203.0.113.70 -> From 192.0.2.1 icmp_seq=1 Packet filtered
ping 203.0.113.130 -> (no reply at all)
ping 2001:db8:a::5 -> From 2001:db8:1::1 icmp_seq=1 Destination unreachable: No route
ping 2001:db8:b::5 -> From 2001:db8:1::1 icmp_seq=1 Destination unreachable: Administratively prohibited
ping 2001:db8:c::5 -> (no reply at all)
ICMPv4 from 192.0.2.1 type 3 code 1 host unreachable
ICMPv4 from 192.0.2.1 type 3 code 13 communication administratively prohibited
ICMPv6 from 2001:db8:1::1 type 1 code 0 no route to destination
ICMPv6 from 2001:db8:1::1 type 1 code 1 administratively prohibited
For IPv4, the unreachable route produced host unreachable (code 1) and prohibit produced communication administratively prohibited (code 13), which ping shows as "Packet filtered". For IPv6, they produced no route (code 0) and administratively prohibited (code 1). The blackhole routes produced nothing at all.
ICMPv6 also defines code 6, reject route to destination, for exactly this kind of route, though Linux uses code 0 instead. Two other ICMPv6 codes are less common:
- Code 2, beyond scope of source address, is for a packet whose source address has too small a scope for its destination, such as a link-local source sent to a global address that's several hops away.
- Code 5, source address failed ingress/egress policy, is for a source address that a filter rejects. An example is a source from a prefix that doesn't belong on that network (anti-spoofing, RFC 3704).
Firewalls: administratively prohibited, port unreachable or nothing
A firewall that blocks traffic has a choice of how to say no. The lab put four rules on r1's forward chain and connected from the client to each port:
- port 23:
reject with icmpx admin-prohibited; - port 25: plain
reject; - port 110:
reject with tcp reset; - port 143:
drop.
connect to port 23 -> curl exit 7: connection failed at once
connect to port 25 -> curl exit 7: connection failed at once
connect to port 110 -> curl exit 7: connection failed at once
connect to port 143 -> curl exit 28: timed out
ICMPv4 from 192.0.2.1 type 3 code 13 communication administratively prohibited
ICMPv4 from 192.0.2.1 type 3 code 3 port unreachable
curl exit code 7 means it couldn't connect, and 28 means it gave up after its timeout; the last two lines are the ICMP messages the client received.
- Port 23 got administratively prohibited (code 13).
- Port 25 got port unreachable (code 3), nftables' default for
reject. It makes the router pretend to be a host with nothing listening. - Port 110 got a TCP RST (a reset segment, TCP's own "no"), so no ICMP appears in the capture, but the client failed just as quickly.
- Port 143 got nothing, and the client timed out.
Which to use is a policy choice (article 37). Prohibited messages tell a sender exactly why, which some sites prefer not to reveal, and many firewalls are configured never to send them. Silent drops make the sender wait.
No listener: port unreachable
When a host receives a UDP datagram for a port no socket is using, it sends port unreachable (ICMPv4 code 3, ICMPv6 code 4). Article 39 showed one, including the copy of the original datagram inside it. TCP doesn't need ICMP for this case: a closed TCP port answers with an RST (article 62).
There's a twist in how applications see port unreachable. The lab sent a UDP request to a closed port from two sockets, an unconnected one (using sendto) and a connected one (using connect first):
unconnected socket: TimeoutError - the error never reaches the application
connected socket: ConnectionRefusedError - [Errno 111] Connection refused
The ICMP error arrived both times, but only the connected socket reported it, as "Connection refused". An unconnected UDP socket can talk to many peers, so the operating system doesn't deliver errors to it by default (on Linux, the IP_RECVERR option changes that). Many simple UDP clients use unconnected sockets, so they keep retrying a closed port until their own timeout expires, ignoring the errors coming back.
Unknown protocol: protocol unreachable
If an IPv4 packet carries a Protocol value the host doesn't implement, it sends protocol unreachable (code 2). IPv6 reports the same situation as a Parameter Problem, shown below.
Packet Too Big
When a router must forward a packet that's larger than the next link's MTU, IPv4 and IPv6 differ:
- An IPv4 router fragments the packet, unless the Don't Fragment (DF) bit is set. Then it drops the packet and sends Destination Unreachable code 4, fragmentation needed and DF set, with the next link's MTU in the message.
- An IPv6 router never fragments. It always drops the packet and sends Packet Too Big (ICMPv6 type 2, its own type, not a Destination Unreachable code), with the MTU.
This article uses "Packet Too Big" for both. In the lab, the link from r1 to the server was set to an MTU of 1400, and the client sent pings that are exactly 1500 bytes:
- a 1472-byte payload, plus 8 bytes of ICMP header and 20 bytes of IPv4 header, with DF set (
-M do); - a 1452-byte payload, plus 8 bytes of ICMP and 40 bytes of IPv6 header.
From 192.0.2.1 icmp_seq=1 Frag needed and DF set (mtu = 1400)
From 2001:db8:1::1 icmp_seq=1 Packet too big: mtu=1400
ICMPv4 from 192.0.2.1 type 3 code 4 fragmentation needed
ICMPv6 from 2001:db8:1::1 type 2 code 0 packet too big
MTU field in the error: 1400
MTU field in the error: 1400
The client's kernel doesn't just report the error. It remembers the smaller MTU for that destination, so later packets are sized to fit:
route cache after the error: mtu 1400
IPv6 route cache after the error: mtu 1400
That's path MTU discovery (RFC 1191 for IPv4, RFC 8201 for IPv6), which TCP and most UDP applications rely on. If these messages are blocked, large packets vanish without any error. That's a path MTU "black hole", a common and frustrating fault. Article 47 covers path MTU discovery (PMTUD) and its alternatives in detail.
Packet Too Big is one of the two errors sent even for multicast packets (article 39), so multicast senders can discover the MTU too.
Redirect
When a host sends a packet to a router on its own link, and that router sees that another router on the same link is a better next hop, it forwards the packet anyway and sends the host a Redirect: ICMPv4 type 5, ICMPv6 type 137. It's a simple way for hosts with a poor default route to learn better ones without running a routing protocol.

In the lab, the client's default routes were changed to point at r2, whose own default route is r1, on the same LAN:
198.51.100.10 via 192.0.2.2 dev eth0 src 192.0.2.10 uid 0
2001:db8:2::10 from :: via fe80::ff:fe00:102 dev eth0 src 2001:db8:1::10 metric 1024 pref medium
These lines come from ip route get, which shows the route the kernel would use for one destination. The part that matters is via, the next-hop router; uid, metric and pref are details it always prints. The IPv6 route points at r2's link-local address. That's deliberate: IPv6 routers identify themselves by link-local addresses, and a host accepts an ICMPv6 redirect only if it comes from the router it's currently using as the next hop, identified by that link-local address. After two pings over each protocol, the client had received redirects from r2:
ICMPv4 from 192.0.2.2 type 5 code 1 redirect for host
ICMPv6 from fe80::ff:fe00:102 type 137 code 0 redirect
ICMPv4 redirect: use gateway 192.0.2.1
And its routing decisions changed:
198.51.100.10 via 192.0.2.1 dev eth0 src 192.0.2.10 uid 0
cache <redirected> expires 295sec
2001:db8:2::10 from :: via fe80::ff:fe00:101 dev eth0 src 2001:db8:1::10 metric 1024 pref medium
For IPv4, Linux stores the redirect as a route exception ("cache <redirected>") that expires after a few minutes. For IPv6, the ICMPv6 redirect's target is r1's link-local address (fe80::ff:fe00:101), and the client now uses it for this destination.
The ICMPv6 Redirect is part of neighbor discovery and works a little differently from ICMPv4's:
- It carries a Target Address, the better next hop, and a Destination Address, the destination it applies to.
- If the two are equal, the destination itself is on the link, so a router can tell a host that a neighbor is directly reachable even if their prefixes differ.
- It can include the target's link-layer address and part of the original packet as options (article 42).
ICMPv4 once had separate redirects for a whole network and for a single host. With classless addressing, only host redirects (code 1) make sense, and that's what r2 sent.
Whether a machine acts on redirects is configurable:
net.ipv4.ip_forward = 0
net.ipv4.conf.eth0.accept_redirects = 1
net.ipv6.conf.eth0.accept_redirects = 1
net.ipv4.conf.eth0.send_redirects = 1
- Hosts accept redirects.
- Routers ignore them (Linux disables acceptance when forwarding is on), because routers should learn routes from routing protocols. They send redirects, which
send_redirectscontrols.
Because redirects can be spoofed by anyone on the link to divert traffic (article 42 covers attacks), many servers and hardened desktops turn accept_redirects off.
Time Exceeded
Every IPv4 packet has a TTL, and every IPv6 packet a Hop Limit. Each router decrements it, and a router that would forward a packet with the value at zero drops it and sends Time Exceeded, ICMPv4 type 11 or ICMPv6 type 3, with code 0. This stops packets from circling forever in a routing loop. The TTL was originally meant to be in seconds, but in practice it has always counted hops, and IPv6 named it accordingly. A ping with TTL 1 expires at the first router:
From 192.0.2.1 icmp_seq=1 Time to live exceeded
From 2001:db8:1::1 icmp_seq=1 Time exceeded: Hop limit
ICMPv4 from 192.0.2.1 type 11 code 0 TTL exceeded in transit
ICMPv6 from 2001:db8:1::1 type 3 code 0 hop limit exceeded in transit
traceroute is built on exactly this message: it sends probes with TTL 1, 2, 3 and so on, and each router's Time Exceeded message reveals its address (article 41).
Code 1 means fragment reassembly time exceeded: a host received some fragments of a datagram, but not all of them before its reassembly timer ran out, so it discarded them all. Only the destination sends this, and only if it received the first fragment, because that's the one that identifies the sender's protocol and ports. In the lab, the server's reassembly timeout was lowered from the default 30 seconds to 3, and the client sent just the first of three fragments (offset 0, with the More Fragments flag, MF, set to 1 to say more follow):
net.ipv4.ipfrag_time = 3
sent fragment 1 of 3 (offset 0, MF=1); the others never arrive
ICMPv4 from 198.51.100.10 type 11 code 1 fragment reassembly time exceeded
Parameter Problem
Parameter Problem, ICMPv4 type 12 or ICMPv6 type 4, is the catch-all for a header that can't be processed. It includes a Pointer field: the byte offset, from the start of the original packet, of the field that caused the trouble.
- ICMPv4 mostly uses code 0, "pointer indicates the error". Code 2 means a bad length. Code 1 ("missing a required option") is historic.
- ICMPv6 has three codes in common use:
- code 0, erroneous header field;
- code 1, unrecognized Next Header;
- code 2, unrecognized IPv6 option.
Later RFCs added more: code 3 for a first fragment that doesn't hold the whole header chain (RFC 7112), and several from RFC 8883 for extension headers or chains too long for a router to process.
The lab sent three hand-made packets to the server with scapy, a Python tool for building packets field by field:
- an IPv6 packet with a Destination Options header containing an option of unknown type
0x8f; - an IPv6 packet with Next Header 150, which has no meaning;
- an IPv4 packet with Protocol 150.
sent: IPv6 with unknown destination option 0x8f; IPv6 with next header 150; IPv4 with protocol 150
ICMPv6 from 2001:db8:2::10 type 4 code 2 unrecognized IPv6 option
ICMPv6 from 2001:db8:2::10 type 4 code 1 unrecognized next header
ICMPv4 from 198.51.100.10 type 3 code 2 protocol unreachable
ICMPv6 parameter problem code 2 pointer 42
ICMPv6 parameter problem code 1 pointer 6
The pointers show exactly where the problem was. For the unknown next header, the pointer is 6, the offset of the Next Header field in the IPv6 header. For the unknown option, it's 42: the 40-byte IPv6 header, plus 2 bytes into the Destination Options header, where the option starts.
Whether an unknown IPv6 option causes an error depends on the option type's two high bits (RFC 8200). 0x8f begins with binary 10, which means "discard the packet and send Parameter Problem code 2". Other patterns mean skip the option, discard silently, or discard and report only if the destination wasn't multicast.
The IPv4 packet with an unknown protocol got protocol unreachable instead, as described above.
Extended ICMP: multipart messages
Traditional ICMP errors carry only the IP header and the start of the original packet. RFC 4884 defined a way to append extension objects after the original packet, for Destination Unreachable, Time Exceeded and Parameter Problem in ICMPv4, and Destination Unreachable and Time Exceeded in ICMPv6.
A length field, in a previously unused byte of the ICMP header, gives the size of the quoted packet so the receiver knows where the extensions start. The quoted packet is then padded to at least 128 bytes.
Two extensions are widely seen:
- MPLS label stacks (RFC 4950). MPLS (Multiprotocol Label Switching) is used inside many ISP networks to forward packets by short labels instead of IP lookups. A router inside an MPLS network quotes the labels of the expired packet, so
traceroutecan show them. - Interface information (RFC 5837). A router identifies which interface received the packet, by index, address, name or MTU, which makes
tracerouteoutput much easier to interpret.
Modern traceroute and mtr print this information when routers include it. RFC 8335's PROBE (article 39) uses the same extension format.
Common questions
Why did ping take several seconds to report host unreachable but reported net unreachable immediately?
Net unreachable comes from a router that has no route, which it knows instantly. Host unreachable comes from the last router after it tried to resolve the destination's link-layer address with ARP or neighbor discovery and got no answer, which takes a few retries, typically about 3 seconds.
Is "Packet filtered" from ping an error in my network?
It's ICMPv4 Destination Unreachable code 13, "communication administratively prohibited". Some device on the path, the one whose address ping shows, deliberately rejected your packet because of a firewall rule or a prohibit route. The network is working. A policy is blocking you.
Should a firewall send rejects or drop silently?
For traffic from your own users, rejects are friendlier: applications fail immediately instead of hanging. For unsolicited traffic from the Internet, many sites drop silently, which gives scanners less information and avoids sending traffic to spoofed addresses. Either way, never block Packet Too Big messages, or path MTU discovery breaks.
My UDP application never sees "connection refused". Why?
Probably because it uses an unconnected socket. The lab showed the same error being ignored on an unconnected socket and reported on a connected one. Use connect() on the UDP socket if it talks to a single peer, or enable error queue reporting (IP_RECVERR on Linux) to receive ICMP errors.
Why do IPv6 routers send Packet Too Big instead of fragmenting?
IPv6 moved fragmentation to the sending host, to keep routers fast and simple. The sender learns the path MTU from Packet Too Big messages and sizes its packets, or fragments them itself with the Fragment extension header. Routers that still find a packet too big drop it and report the MTU.
Are redirects dangerous?
They can be. Anyone on the local link can forge an ICMP redirect to send a host's traffic through themselves. Linux makes some checks, such as only accepting redirects from the current gateway, and IPv6 requires them to come from the current router's link-local address with a hop limit of 255, so they can't come from off the link. On networks with a single router, turning off accept_redirects is a common hardening step.
Summary
- Destination Unreachable reports why a packet couldn't be delivered:
- net unreachable or no route, from a router without a route;
- host or address unreachable, when final ARP or neighbor discovery fails;
- administratively prohibited, from filters and prohibit routes;
- port unreachable, from a host with no listener;
- protocol unreachable, for IPv4.
- Blackhole routes and
droprules send nothing, and senders time out. - Applications see ICMP errors only on connected sockets, unless they ask for them. Unconnected UDP clients ignore them.
- Packet Too Big (ICMPv4 type 3 code 4, ICMPv6 type 2) carries the next link's MTU and drives path MTU discovery. The lab client cached the smaller MTU at once.
- Redirect tells a host to use a better router on the same link. ICMPv6 redirects must come from the current router's link-local address. Hosts accept them and routers don't.
- Time Exceeded code 0 means the TTL or hop limit ran out (the basis of traceroute), and code 1 means reassembly timed out.
- Parameter Problem points at the byte that caused the trouble. IPv6 uses it for unknown next headers (pointer 6 in the lab) and unknown options whose type says to report them (pointer 42).
- RFC 4884 extensions let errors carry extra objects, such as MPLS labels or the receiving interface's identity.
Practice questions
1. A ping to a host on a remote network returns "Destination Host Unreachable" from 203.0.113.1 after about three seconds. What does that tell you?
Answer
The router at 203.0.113.1 has a route to the destination's network, and it's probably directly connected to it, but it couldn't resolve the host's link-layer address with ARP. The host is probably down, disconnected or misaddressed. The delay is the router's ARP retries.
2. An IPv4 router receives a 1500-byte packet with DF set, and the next link has an MTU of 1280. What does it send back, and what number does the message contain?
Answer
ICMPv4 Destination Unreachable, code 4 (fragmentation needed and DF set), with the next-hop MTU field set to 1280. The sender's path MTU discovery then reduces its packet size for that destination.
3. A host's default gateway is 192.0.2.2. It sends a packet for 198.51.100.10, and 192.0.2.2 forwards it to 192.0.2.1 on the same subnet. What will 192.0.2.2 send to the host, and what changes on the host afterward?
Answer
An ICMP Redirect (ICMPv4 type 5, code 1, redirect for host) telling it to use 192.0.2.1 for 198.51.100.10. If the host accepts redirects, it adds a route exception so that later packets to 198.51.100.10 go directly to 192.0.2.1. Other destinations still use the default gateway.
4. A capture shows ICMPv6 type 4, code 1, pointer 40. What went wrong?
Answer
Parameter Problem with an unrecognized Next Header value. A pointer of 40 points just past the 40-byte IPv6 header, to the first byte of the first extension header, which is that header's own Next Header field. So the packet had one extension header whose Next Header value the receiver didn't recognize.
5. Why does a destination send "fragment reassembly time exceeded" only if it received the first fragment?
Answer
Only the first fragment contains the transport header, and an ICMP error must quote the start of the original datagram so the sender can match it to a protocol and socket. Without the first fragment, there's nothing useful to quote, and the error rules (article 39) forbid errors about non-first fragments anyway.
6. A firewall rule is changed from reject to drop for TCP port 25. What changes for a client trying to connect?
Answer
With reject, the firewall sends an ICMP port unreachable (nftables' default) and the client's connection fails immediately. With drop, nothing comes back. The client retransmits its SYN with exponential backoff and eventually times out, which typically takes many seconds to minutes.
Previous: ICMP: Message Types, Encapsulation and the Rules for Sending Errors
Next: ping and traceroute: How They Work and How to Read Them

More in TCP/IP Course
Quiz: TCP/IP Delicate Details
Twenty-five questions on the details that catch out experienced engineers: sequence numbers for SYN and FIN, TIME_WAIT versus tcp_fin_timeout, Karn's algorithm, socket buffer doubling, even and odd ephemeral ports, IPv6 checksums and fragmentation, negative DNS caching, and capture filter traps.
Quiz: TCP/IP Interview Questions
Thirty-three networking questions of the kind asked in developer, SRE and network engineering interviews: what happens when you load a URL, TCP versus UDP, handshakes, closing and TIME_WAIT, subnetting, NAT, DNS, MTU problems, congestion, TLS and QUIC, and debugging slow or failing connections.
Quiz: TCP/IP Course Final Exam (All Parts)
The final exam for the TCP/IP course: thirty questions across all fourteen parts, from packets and addressing through Ethernet, ARP, IP, DHCP, NAT, ICMP, UDP, DNS, TCP connections, reliability, congestion control, security, QUIC and troubleshooting.
Quiz: Modern Transports and Troubleshooting (TCP/IP Part 14)
Review modern transports and troubleshooting: QUIC packets, handshakes, 0-RTT, streams and connection migration, HTTP/3, Multipath TCP, SCTP multihoming, and a layered method for diagnosing real network faults.
Discussion
Sign in to ask a question or share what you learned.