Filtering ICMPv6 correctly
Classify ICMPv6 types as must-allow, should-allow, policy and drop, for transit and for local delivery (RFC 4890). Write host and transit ICMPv6 firewall policy in nftables. Prove that Neighbor Discovery and Path MTU Discovery still work after filtering.
Take the quiz · pass mark 70% · 9 questions
Explanation
In IPv4 many sites block all ICMP and nothing obvious breaks. Doing the same to ICMPv6 breaks the network, because ICMPv6 carries Neighbor Discovery, Router Advertisements, MLD and Packet Too Big. ICMPv6 (the protocol itself is RFC 4443) must be filtered selectively. RFC 4890 is the reference, and it separates two cases:
- Transit traffic: ICMPv6 passing through a firewall/router to hosts behind it.
- Local traffic: ICMPv6 addressed to the firewall's own interfaces.
Must not be dropped (both transit and local)
These are essential, and blocking them is the classic self-inflicted outage:
| Type | Message | Why |
|---|---|---|
| 1 | Destination Unreachable (all codes) | Error signalling, fast connection failure |
| 2 | Packet Too Big | PMTUD; without it, large packets black-hole (L4.08) |
| 3 code 0 | Time Exceeded (hop limit) | traceroute, loop detection |
| 4 codes 1,2 | Parameter Problem | malformed-header signalling |
| 128/129 | Echo Request / Reply | ping and basic reachability |
RFC 4890 notes that, unlike IPv4, there is no good reason to block IPv6 Echo Request at the firewall: address scanning of a /64 is infeasible (L5.06), so the old "hide from ping" habit costs more than it gains.
Link-local ND and MLD (local delivery / same link only)
Neighbor Discovery and MLD must work on the link, but must not cross a router (they carry Hop Limit 255 and are checked for it):
- Router Solicitation (133), Router Advertisement (134), Neighbor Solicitation (135), Neighbor Advertisement (136), Redirect (137, by policy)
- MLD: Listener Query (130), Report (131), Done (132), MLDv2 Report (143)
A router does not forward these anyway, but a host firewall must allow them inbound, or the host cannot do ND and falls off the network. Many host failures come from a default-deny ruleset that forgets ND.
Should allow, policy, and drop
- Normally allow (transit): Time Exceeded code 1 (reassembly), Parameter Problem code 0.
- Define a policy: Redirect (137) — usually drop at a security boundary, allow on a trusted LAN. Unallocated and experimental types.
- Drop unless justified: Node Information Query/Response (139/140), Router Renumbering (138).
Rate-limiting and hardening
- Rate-limit ICMPv6 error generation and forwarding, so error messages cannot be used for amplification or to overload the control plane (RFC 9099). nftables
limitdoes this. - Accept ND only with Hop Limit 255 (
ip6 hoplimit 255), which rejects ND injected from off-link. - RFC 6980 forbids fragmented Neighbor Discovery: drop fragmented ND (L5.04).
- RFC 8504 (IPv6 Node Requirements) and RFC 8201 (PMTUD) are the normative backing for allowing the error types above.
nftables example
A host policy in the inet family (works for IPv4 and IPv6):
table inet filter {
chain input {
type filter hook input priority filter; policy drop;
ct state established,related accept
iif lo accept
# ICMPv6 that must work, with hop-limit check for ND
ip6 nexthdr icmpv6 icmpv6 type { destination-unreachable, packet-too-big,
time-exceeded, parameter-problem, echo-request, echo-reply } accept
icmpv6 type { nd-router-advert, nd-neighbor-solicit, nd-neighbor-advert,
nd-router-solicit } ip6 hoplimit 255 accept
icmpv6 type { mld-listener-query, mld-listener-report, mld-listener-done,
mld2-listener-report } ip6 saddr fe80::/10 accept
# your services
tcp dport { 22, 443 } accept
}
}
A transit policy on a router adds a forward chain that permits the must-allow error types in both directions, rate-limits them, and does not need to pass link-local ND (the router terminates it):
chain forward {
type filter hook forward priority filter; policy drop;
ct state established,related accept
icmpv6 type { destination-unreachable, packet-too-big, time-exceeded,
parameter-problem } limit rate 1000/second accept
icmpv6 type echo-request limit rate 100/second accept
# ... your inbound service policy and outbound policy ...
}
Keywords differ between firewalls: nftables uses names like nd-router-advert and mld2-listener-report; iptables/ip6tables uses numeric --icmpv6-type; VyOS, MikroTik RouterOS and pf each have their own syntax. Check the exact keywords on your platform and version.
Proving it still works
A filter is only correct if it is tested against a matrix: for each important message, from each zone, the expected result (pass or drop) and the observed one. The lab builds one.
ictNetworks scenario
ictNetworks ships a standard ICMPv6 ruleset with every managed firewall: the must-allow error and echo types end to end, ND and MLD on each segment, Redirect dropped at zone boundaries, and rate limits on error generation. The ruleset is version-controlled and tested with the matrix below after every change, because a broken PMTUD or ND rule is one of the most common tickets.
Drawing diagram…
Worked examples
Example 1: The must-allow set
Across a security boundary, the ICMPv6 types that RFC 4890 says must not be dropped (error plus connectivity) are types 1, 2, 3 (code 0), 4 (codes 1 and 2), 128 and 129: six type values.
Example 2: Why PTB matters here
A server behind the firewall sends 1500-byte responses; a client is behind a 1280-byte link. If the firewall drops type 2, the client's Packet Too Big never reaches the server, the server keeps sending 1500-byte packets, and the download stalls after the handshake (L4.08). Allowing type 2 fixes it.
Example 3: The hop-limit guard
An attacker off-link sends a forged NA to poison a host's cache. With icmpv6 type nd-neighbor-advert ip6 hoplimit 255 accept and a default drop, the forged NA (which cannot arrive with hop limit 255 from off-link) is dropped, because a router decremented its hop limit. Legitimate on-link NAs arrive with 255.
Lab
Goal: Write host and transit ICMPv6 policies and verify them against a test matrix.
You need: a namespace lab with a client, a router/firewall running nftables, and a server behind it; a link with MTU 1280 somewhere in the path to the server; Scapy on the client to craft ICMPv6.
- Start from a default-drop host policy on the server without any ICMPv6 rules. Show that the server falls off the network (no ND, cannot be pinged, neighbours FAILED). Add the must-allow and ND/MLD rules and show it recover.
- On the router, write a transit policy: default drop in forward, allow established, allow the must-allow error types (rate-limited) and echo, plus your service rules. Verify ping client↔server both ways.
- Insert the 1280-byte link. Confirm a large transfer works (PTB passes). Then add a rule dropping
icmpv6 type packet-too-bigin forward and show the transfer stalling; remove it. - Add
ip6 hoplimit 255to the ND accept rules. From the client, use Scapy to send an NA with hop limit 64 and show it is dropped, and one with hop limit 255 and show it is accepted. - Build and run a test matrix: for each of ND (RS/RA/NS/NA), MLD report, echo, PTB, dest-unreach, time-exceeded, Redirect and Node Information Query, from the client zone and the Internet zone, record expected vs observed (pass/drop). Fix any mismatch.
What to submit: the nftables rulesets, captures for steps 1–4, and the completed test matrix.
Summary
- Never block ICMPv6 wholesale. Types 1, 2, 3/0, 4/1, 4/2, 128 and 129 must pass everywhere.
- ND (133–137) and MLD (130–132, 143) must work on the link; hosts must allow them inbound, routers terminate them.
- Allow IPv6 Echo Request: /64 scanning is infeasible, so hiding from ping costs more than it helps.
- Guard ND with hop limit 255, rate-limit errors, and drop fragmented ND.
- Always verify the policy with a test matrix covering each message and zone.
- Next lesson (L5.03): first-hop security.
Quiz imported · 9 questions · pass mark 70%. Lab questions are not auto-marked.