Stateful firewalls and perimeter policy
Build a default-deny inbound IPv6 perimeter without NAT, using connection tracking. Apply the CPE simple-security recommendations (RFC 6092) and node requirements. Write zone policy for global (GUA) and unique-local (ULA) addresses.
Take the quiz · pass mark 70% · 9 questions
Explanation
In IPv4, NAT accidentally provided a perimeter: with no port forward, nothing could start a connection to an inside host. IPv6 has no NAT (and should not: NAT breaks end-to-end, complicates logging and adds no real security). Every host has a globally routable address, so the perimeter must be an explicit stateful firewall. This is a feature, not a loss: you get a real, auditable policy instead of an accident, and it is the model RFC 9099 and the node requirements (RFC 8504) assume.
Stateful, default-deny inbound
The model is the same as a good IPv4 firewall:
- Outbound connections from inside are allowed and tracked.
- Inbound replies that match a tracked connection are allowed (
ct state established,related). - New inbound connections are denied by default, except explicit allows for published services.
- Essential ICMPv6 passes in both directions (L5.02).
Because addresses are stable and global, inbound allow rules name the actual destination address, not a NAT'd one. A server at 2001:db8:3000:10::25 is reached directly on that address; you open port 443 to it, nothing else.
RFC 6092: simple security for CPE
RFC 6092 is the recommendation set for home and small-office customer edge routers (and RFC 7084 lists the requirements an IPv6 CE router must meet, referencing it). The default for a residential CE router is:
- Default-deny unsolicited inbound, allow outbound and its return traffic (stateful).
- Allow the ICMPv6 that must pass (L5.02).
- Permit IPsec (ESP/AH, and IKE on UDP 500/4500) to pass through, so inside hosts can run VPNs.
- Provide a way for the user to add inbound exceptions (the IPv6 equivalent of a port forward, but without the address translation).
- Some CE routers default to allow outbound-initiated only but can be switched to a transparent mode; RFC 6092 describes both and recommends default-deny.
This gives home users NAT-like protection without NAT. It does not replace host security: hosts still need their own firewalls and patching.
GUA and ULA zones
Many networks run both global unicast (GUA) for Internet-reachable traffic and unique-local (ULA, fc00::/7) for internal-only services (L2). Firewall policy should treat them as zones:
- ULA must never cross the Internet perimeter. Drop any packet with a ULA source or destination at the edge, in both directions. ISPs also drop ULA.
- Default address selection (RFC 6724) prefers ULA→ULA and GUA→GUA, which keeps internal traffic on ULA and external on GUA, but the firewall must enforce it, not assume it.
- Internal segmentation (server zone, user zone, management zone, guest zone) uses the same stateful model between internal interfaces, keyed on the prefix of each zone.
- Avoid relying on link-local for anything that must cross a router; it cannot.
Anti-spoofing and hygiene
- Ingress filtering (BCP 38, SAVI from L5.03): drop packets whose source address could not legitimately come from that interface.
- Drop bogons and your own prefixes arriving from outside (as in L4.05), and drop ULA and documentation space at the edge.
- Rate-limit new connections and ICMPv6 errors.
- Log denied inbound for visibility (L5.08).
nftables perimeter skeleton
define WAN = eth0
define LAN = eth1
define SERVERS = 2001:db8:3000:10::/64
define ULA = fc00::/7
table inet edge {
chain forward {
type filter hook forward priority filter; policy drop;
ct state established,related accept
ct state invalid drop
# ULA must not cross the perimeter
iif $WAN ip6 saddr $ULA drop
oif $WAN ip6 daddr $ULA drop
iif $WAN ip6 daddr $ULA drop
# essential ICMPv6 (see L5.02), rate-limited
icmpv6 type { destination-unreachable, packet-too-big, time-exceeded,
parameter-problem } limit rate 1000/second accept
icmpv6 type echo-request limit rate 50/second accept
# published services only
iif $WAN ip6 daddr $SERVERS tcp dport { 443 } ct state new accept
# inside to Internet
iif $LAN oif $WAN accept
}
}
Keywords and connection-tracking behaviour differ between nftables, VyOS, MikroTik RouterOS and pf; verify on your platform and version. On MikroTik RouterOS the equivalent is an ipv6 firewall filter with connection-state=established,related,new rules and address-lists for the zones.
ictNetworks scenario
ictNetworks' managed enterprise edge is a default-deny stateful IPv6 perimeter: outbound allowed and tracked, inbound only to published services on their real GUAs, ULA dropped both ways at the edge, BCP 38 ingress filtering on every customer port, and the L5.02 ICMPv6 ruleset. For residential customers it ships CE routers that meet RFC 7084 and default to RFC 6092 simple security, with a self-service portal for inbound exceptions. Host firewalls are still required by policy; the perimeter is one layer.
Drawing diagram…
Worked examples
Example 1: Replacing a NAT port-forward
In IPv4 you had 203.0.113.10:443 → 192.0.2.25:443. In IPv6 there is no translation: the server already has 2001:db8:3000:10::25, and the rule is simply "allow new inbound TCP 443 to 2001:db8:3000:10::25". DNS publishes the AAAA for that address.
Example 2: The ULA leak
An internal monitoring box uses ULA fdf1:a861:26b6:9::5. A misconfigured app tries to reach an Internet service from that source. Without the edge rule, the packet leaves with a ULA source and the reply can never return (ISPs drop ULA), wasting time debugging. The iif $WAN/oif $WAN ULA drops make the failure local and clear, and stop ULA ever leaking out.
Example 3: Counting the default-deny
A perimeter publishes exactly two services (TCP 443 and TCP 25 to one server each). The number of new inbound flows the forward policy accepts from the WAN, besides the essential ICMPv6, is 2; everything else new from the WAN hits the default drop.
Lab
Goal: Build the enterprise edge policy and test it from the "Internet" host.
You need: a namespace lab with an "Internet" host, an edge firewall/router (nftables, or MikroTik RouterOS), a server zone and a user zone; a ULA assigned to an internal host; nmap on the Internet host.
- Build the default-deny stateful forward policy: established/related accept, invalid drop, essential ICMPv6, inside-to-Internet allowed, and one published service (TCP 443 to the server's GUA).
- From the user zone, open outbound connections (HTTP, DNS, ping) and show they work and return. From the Internet host,
nmap -6the server and show only 443 open and everything else filtered. - Add the ULA drops. From the ULA host, try to reach the Internet and show the packet dropped at the edge (capture). Confirm internal ULA↔ULA still works.
- Test anti-spoofing: from the Internet host, send a packet with a source in your own GUA prefix and show it dropped by the ingress rule.
- Simulate an RFC 6092 CE router: a second firewall with default-deny inbound, stateful outbound, IPsec pass-through and one user-added inbound exception. Show a VPN (ESP/IKE) from inside working and an unsolicited inbound connection blocked except the exception.
- Show the deny log for the blocked attempts.
What to submit: the firewall configurations, the nmap output before and after, captures of the ULA and spoofing drops, the CE-router test, and the deny log.
Summary
- IPv6 has no NAT; the perimeter is an explicit stateful, default-deny-inbound firewall on real global addresses.
- Allow outbound and tracked returns; allow only published services inbound; pass essential ICMPv6.
- RFC 6092 (with RFC 7084) defines simple security for CE routers: default-deny inbound, stateful outbound, IPsec pass-through, user exceptions.
- Treat GUA and ULA as zones; drop ULA at the Internet perimeter in both directions.
- Add BCP 38 ingress filtering, bogon drops, rate limits and deny logging; host firewalls still matter.
- Next lesson (L5.06): reconnaissance, scanning and address privacy.
Quiz imported · 9 questions · pass mark 70%. Lab questions are not auto-marked.