Your IPv6 Addresses Are Publicly Routable: Firewalling Them Properly

NAT was never a firewall, and IPv6 finally makes that impossible to ignore

Contents

I turned on IPv6 for the first time expecting it to be a mostly cosmetic change — new addresses, same firewall behaviour, nothing structurally different about how reachable my devices were from the internet. Then I ran an external scan against my own IPv6 prefix out of curiosity and found my NAS answering on its actual IPv6 address, reachable directly from the public internet, because the firewall ruleset I’d spent years tuning was written entirely in terms of IPv4 and NAT, and none of it applied.

That’s the thing about IPv4-era instincts on a dual-stack network: NAT was never a security feature, even though it functioned like one for most home networks by accident. Every device behind a NAT’d IPv4 connection is unreachable from outside as a side effect of address scarcity, purely because there’s no public address to route to it in the first place — the NAT boundary was never a deliberate access control decision. IPv6 removes that side effect entirely. Every device on a modern IPv6 network gets its own globally routable address, and if your firewall isn’t doing real, explicit inbound filtering on that address space, “no NAT” quietly becomes “no filtering.”

Why there’s no IPv6 NAT to rely on

IPv6 was designed with address space large enough (a typical home ISP delegation is a /56 or /64, which is more addresses than the entire IPv4 internet, many times over) that the scarcity problem NAT solved for IPv4 simply doesn’t exist. Every device — laptop, phone, smart plug, NAS — gets its own address out of that block, globally unique, globally routable. There’s no translation step, no shared public IP standing in front of a pool of private ones.

This is a genuine improvement for connectivity — no more STUN/TURN workarounds for peer-to-peer applications, no more carrier-grade NAT breaking inbound connections for VoIP or gaming, no more juggling port forwards for every device that wants to be reachable. It also means the implicit protection NAT gave you, entirely as a side effect of translation needing somewhere to route “return” traffic and having nowhere to send unsolicited inbound packets, is gone. Reachability now depends entirely on whether your firewall’s inbound rules say yes or no — there’s no structural scarcity doing part of the job for you anymore.

What your firewall needs to actually do

The mental model that transfers cleanly from IPv4 is “default deny inbound, explicit allow for what you actually want reachable” — the same posture a well-configured IPv4 firewall already has for its WAN-facing rules. The difference is that on IPv4, a lot of homelabs never had to think hard about this, because NAT made “not forwarded” the default state for everything and only deliberate forwards changed that. On IPv6, nothing is implicitly unreachable — every rule has to be written, because every device is theoretically reachable unless something explicitly blocks it.

On OPNsense, the WAN interface needs its own IPv6-specific rule set, separate from IPv4 — it’s easy to assume a “block all, allow established” rule you wrote once covers both address families, and it doesn’t unless you built it that way deliberately.

1
2
3
4
# Firewall > Rules > WAN (IPv6 tab specifically — not shared with IPv4)
Action: Pass    Proto: IPv6 ICMP   Type: any (see below)   Source: any
Action: Pass    Proto: any         State: established/related
Action: Block   Proto: any         Source: any    Destination: any

That first rule — allowing ICMPv6 — isn’t optional the way ICMP is on IPv4. IPv6’s neighbour discovery, path MTU discovery, and address autoconfiguration all run over ICMPv6, and blocking it wholesale breaks fundamental IPv6 operation on your network, not just diagnostic pings. The rule needs to be scoped to the specific ICMPv6 types that are structurally necessary (neighbour solicitation/advertisement, router solicitation/advertisement, packet-too-big, time-exceeded) rather than either blanket-allowing all ICMPv6 or blanket-blocking it — a bare “block all ICMPv6” is a common well-intentioned mistake that breaks the protocol itself.

1
2
3
4
5
6
7
# Minimum ICMPv6 types to allow inbound on WAN for IPv6 to function correctly
Router Solicitation / Advertisement
Neighbor Solicitation / Advertisement
Packet Too Big
Time Exceeded
Parameter Problem
Echo Request/Reply   # optional — diagnostic only, safe to drop if you don't want to be pingable

Privacy extensions: the address changes, but the /64 doesn’t

Modern operating systems generate temporary addresses for outbound connections by default (RFC 4941 privacy extensions) specifically so a device isn’t trivially trackable across sessions by its stable IPv6 address — a laptop making outbound connections gets a new temporary address periodically rather than always using the same one. This is good for privacy against sites tracking you across visits, and it has a side effect worth understanding: your firewall rules generally shouldn’t be written against a specific device’s current IPv6 address, because that address is deliberately not stable.

For rules that need to target a specific device reliably — a server, a NAS, anything you want addressable rather than anonymous — disable privacy extensions on that device specifically and give it a stable address (either via DHCPv6 reservation-equivalent mechanisms or a manually assigned address within your delegated prefix), rather than trying to firewall against an address that rotates. Trying to build stable inbound rules against a client device using privacy extensions is fighting the feature rather than working with it.

Auditing what’s actually reachable

Don’t take a written ruleset’s word for it — scan your own IPv6 addresses from outside, the same way you would (or should) for IPv4.

1
2
# from an external host — replace with your actual delegated address/range
nmap -6 -Pn -p1-1024 2001:db8:abcd:1::5

Unlike an IPv4 scan of a NAT’d network, where there’s one public IP to check, a full IPv6 network has far too many possible addresses per subnet to brute-force scan exhaustively — a /64 has more addresses than anyone could enumerate. This is sometimes mistaken for a security property in itself (“they’d never guess the address”), which is a bad assumption to build on. Addresses far more often surface through normal use — DNS records, a device’s outbound connections revealing its own address to whatever it connected to, addresses leaking through application logs or referrer headers. Assume any address a device has used for outbound communication could become known, and firewall based on that rather than relying on the address space being large.

The three address scopes, and why the distinction matters for rules

IPv6 devices typically carry more than one address simultaneously, each with a different scope, and firewall rules need to account for which is which rather than treating “the IPv6 address” as a single thing to reason about. Link-local addresses (fe80::/10) exist on every interface automatically, aren’t routable beyond the local segment, and are used for neighbour discovery and other on-link protocol machinery — you generally don’t firewall these at all, since they can’t leave the local network regardless. Unique local addresses, ULAs (fc00::/7, in practice almost always seen as fd00::/8), are IPv6’s rough equivalent of RFC 1918 private space — not globally routable, useful for internal-only communication that should keep working even if your WAN’s global prefix changes (which does happen, since most home ISP delegations are not guaranteed static). Global unicast addresses, GUAs, are the actual public, globally routable addresses this whole article is about, assigned out of your ISP’s delegated prefix.

A device commonly holds a link-local, a ULA, and one or more GUA (temporary and/or stable) addresses at once, each for a different purpose. Firewall rules aimed at controlling internet reachability need to target the GUA specifically — writing a rule against a device’s ULA does nothing to control what’s reachable from the actual internet, since a ULA was never routable out there to begin with. This distinction is worth internalising before writing any IPv6 firewall rule, because a rule that looks correct against the wrong address scope will pass every test you run from inside your own network while doing nothing to the actual exposure from outside.

Doing this on a single-box ufw or nftables setup

Not everyone running IPv6 has a dedicated firewall appliance — plenty of single-server setups rely on ufw or nftables directly on the box itself. Both handle IPv6 as a genuinely separate rule set from IPv4, and the same principle applies: don’t assume a rule you wrote targeting IPv4 syntax automatically covers IPv6 traffic.

ufw needs IPv6 support enabled explicitly in its own config before it manages the v6 rules at all:

1
2
# /etc/default/ufw
IPV6=yes

With that set, ufw allow rules apply to both families automatically for hostname-less rules, but anything referencing a specific address needs the address family made explicit — ufw allow from 2001:db8::5 behaves differently from an IPv4-shaped rule and needs its own verification, the same external-scan check described above, rather than trusting that a rule “looks right” in the config output.

nftables keeps IPv4 and IPv6 fully separate at the table/chain level unless you deliberately write an inet family table that covers both:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# using an `inet` table covers both v4 and v6 in one rule set,
# rather than needing separate ip and ip6 tables maintained in parallel
table inet filter {
    chain input {
        type filter hook input priority 0; policy drop;
        ct state established,related accept
        icmpv6 type { nd-neighbor-solicit, nd-neighbor-advert,
                       nd-router-solicit, nd-router-advert,
                       packet-too-big, time-exceeded } accept
        tcp dport 22 accept
    }
}

Using table inet rather than separate table ip and table ip6 tables is the single easiest way to avoid the “I only wrote the IPv4 half” mistake on a small server — one rule set, evaluated against both address families, with no risk of the two silently drifting apart as you add rules over time.

Troubleshooting: things that break when IPv6 filtering goes wrong

Over-blocking ICMPv6 is the single most common self-inflicted IPv6 problem — a firewall that blocks all ICMPv6 inbound on the WAN interface, applied with IPv4-era instincts about ICMP being mostly a diagnostic nuisance, breaks path MTU discovery specifically. The symptom is bizarre: small requests work fine, but anything transferring larger payloads mysteriously stalls or hangs, because a router along the path that needs to signal “packet too big, fragment or reduce your size” via ICMPv6 can’t get that message back to you, and the sender never learns it needs to adjust. If large file transfers or specific websites hang on IPv6 while small requests work fine, this is the first thing to check — temporarily allow all ICMPv6 inbound and see if it resolves, then narrow the rule back down to the specific necessary types rather than leaving it wide open.

Under-blocking is the flip side and the reason this whole topic matters: a firewall that never got IPv6-specific rules at all, inheriting only IPv4 rules that don’t apply to the new address family, leaves every device on the network reachable on any port it happens to be listening on. This is exactly what I found scanning my own network — check for it the same way, with an external scan, rather than trusting a read of the ruleset to confirm it covers both protocols.

Is it worth it

Not optional if you’ve enabled IPv6 at all — which, worth saying plainly, is worth doing (better peer-to-peer connectivity, no CGNAT headaches, a protocol that’s increasingly what modern ISPs and CDNs actually prefer). The firewall work isn’t a large lift once you understand the mental model shift: default-deny inbound, explicit allows for what should be reachable, careful scoped ICMPv6 permits so discovery and path MTU keep working, and stable addressing for anything you deliberately want reachable rather than fighting privacy extensions. An afternoon spent on this closes a gap that, unaddressed, silently undoes years of careful IPv4 firewall work the moment IPv6 gets turned on.

Smarc
Written by Smarc

Founder and editor of Aside House. A lifelong tinkerer who self-hosts far more than is sensible, hardens Linux boxes for fun, and prods the latest AI tools to see what they can really do. The how-to guides here are the notes Smarc wishes had existed the first time round.

Smarc is the editor of Aside House. The homelab, the hardware and the opinions are real; the guides are drafted with AI assistance. Infrastructure details are genericised on purpose.