Skip to main content
RunBook Academy

OPNsenseXVI · IPv6IPv6 firewall

IPv6 firewall rules — address families, ICMPv6, and why "block all IPv6" is dangerous

Advanced⏱ ~16 minpfctltcpdumpping6ndp

What you'll learn

  • Explain the address-family difference between IPv4 and IPv6 firewall rules
  • Identify the ICMPv6 types that must be permitted for IPv6 to function
  • Write IPv6 firewall rules that match SLAAC, DHCPv6, and prefix delegation traffic
  • Recognise why "block all IPv6" creates blind spots and operational risk
  • Plan an IPv6 rule set that mirrors the IPv4 rule set

Prerequisites

Verified against OPNsense 25.x · FreeBSD 14.x · PF (FreeBSD packet filter) FreeBSD 14.x · Unbound 1.20+ · Kea DHCP OPNsense 25.x plugin · WireGuard in-kernel + OPNsense plugin · strongSwan (IPsec plugin) OPNsense 25.x plugin · OpenVPN 2.6.x · Suricata 7.x · 2026-08-14

Not yet marked complete on this device.

IPv6 firewalling is not “IPv4 firewalling with longer addresses”. IPv4 and IPv6 are independent protocol families in PF. A rule that permits an IPv4 flow does not permit the equivalent IPv6 flow; the operator must write a parallel rule for IPv6, with the same semantics but the different address family. The most common production failure is to write excellent IPv4 rules and then leave IPv6 wide open — or block all IPv6, which breaks the protocol in subtle ways.

This lesson covers the address-family difference, the ICMPv6 types that must be permitted for IPv6 to function, and the production patterns for IPv6 rule sets.

Address families are independent

In PF and OPNsense, every firewall rule has an Address Family field: IPv4 only, IPv6 only, or IPv4+IPv6. The default for new rules in many configurations is IPv4 only. A rule that permits inbound SSH on IPv4 does not permit inbound SSH on IPv6 — IPv6 traffic is matched against IPv6 rules separately.

The implication: every IPv4 rule needs an IPv6 counterpart if the operator wants IPv6 to be governed by the same policy. The OPNsense “Address Family” option “IPv4+IPv6” lets a single rule match both families; this is the right tool for rules that should apply symmetrically.

Read-only / Safecompiled IPv4 + IPv6 rules
$ pfctl -sr | grep -E 'pass|block' | head -10
pass in quick on igb1 inet proto tcp from any to (self) port = https flags S/SA keep state
pass in quick on igb1 inet6 proto tcp from any to (self) port = https flags S/SA keep state
block in quick on igb0 inet all
block in quick on igb0 inet6 all
pass in on igb1 inet from 192.168.1.0/24 to any keep state
pass in on igb1 inet6 from 2001:db8:abcd:e000::/64 to any keep state

Illustrative output

ICMPv6 is not optional

ICMPv6 carries critical protocol functions that IPv4 ICMP does not:

ICMPv6 typeFunctionWhy blocking breaks IPv6
Type 1 (Destination Unreachable)Reports unreachable destinationsHosts cannot adapt to path failures
Type 2 (Packet Too Big)Path MTU DiscoveryTCP connections fail on MTU mismatches
Type 3 (Time Exceeded)Traceroute, loop detectionDiagnostic tools fail
Type 128-129 (Echo Request/Reply)ping6Loss of basic connectivity test
Type 133-134 (RS/RA)Router Solicitation / AdvertisementSLAAC breaks; hosts cannot self-configure
Type 135-136 (NS/NA)Neighbor Solicitation / AdvertisementARP-equivalent breaks; no L2 resolution
Type 143 (MLDv2 report)Multicast Listener DiscoveryMulticast breaks

ICMPv6 types 133-136 (SLAAC and Neighbor Discovery) are the protocol’s equivalent of ARP. Block them and IPv6 stops working — every host on the segment can no longer resolve its gateway’s MAC, can no longer self-configure, and can no longer detect duplicate addresses. The operator sees “IPv6 does not work on the LAN” and the firewall log shows nothing because the firewall silently dropped the ICMPv6 messages.

The minimum IPv6 rule set

For a typical OPNsense estate with IPv6 enabled on WAN and LAN, the minimum IPv6 rule set:

InterfaceDirectionAddress familySourceDestinationProtocolActionPurpose
WANininet6anyanyicmp6pass (limited)Permit essential ICMPv6
WANininet6any(self)tcp 80, 443passPermit inbound web
WANininet6anyanyanyblockDefault deny
LANininet6fe80::/10ff02::/16icmp6passPermit RS/RA/NS/NA multicast
LANininet6LAN prefixanyanypassPermit LAN egress
LANininet6anyanyanyblockDefault deny

The LAN-side rules for RS/RA/NS/NA are critical. SLAAC and Neighbor Discovery use multicast on the LAN segment; if the LAN default-deny rule blocks ICMPv6 multicast, SLAAC breaks.

Writing the rules in OPNsense

In the OPNsense GUI, each rule has an “Address Family” field:

  • IPv4: matches IPv4 traffic only.
  • IPv6: matches IPv6 traffic only.
  • IPv4+IPv6: matches both. Useful when the rule’s logic applies identically to both families.

For rules that govern SLAAC, Neighbor Discovery, and Router Advertisements, set the protocol to ICMPv6 and the type to the relevant type numbers. OPNsense exposes ICMPv6 type filtering under the rule’s “ICMP type” field.

For rules that permit specific ICMPv6 types, OPNsense exposes a checkbox list. The operator selects “Router Advertisement”, “Router Solicitation”, “Neighbor Solicitation”, “Neighbor Advertisement”, and the essential error types.

Mirror the IPv4 rule set

The right pattern for a production estate:

  1. Build the IPv4 rule set first. Apply the same operational discipline to IPv4 that you would to any firewall.
  2. Mirror every IPv4 rule to IPv6. For each IPv4 rule, create an IPv6 counterpart with the same source, destination, port, action, and direction. Use “IPv4+IPv6” where the rule’s semantics are identical.
  3. Add the ICMPv6 rules. Permit RS, RA, NS, NA on the LAN; permit essential ICMPv6 error types on WAN.
  4. Audit the rules. Firewall → Rules shows both families; review both. A rule that is in IPv4 only is a hole in IPv6.

The mirroring discipline produces two parallel rule sets. They are identical in intent and differ only in the addresses they reference. The operator who has to debug an incident looks at the same logic on both families.

Verifying IPv6 rules

The verification steps:

# Confirm the compiled ruleset
pfctl -sr | grep inet6

# Capture inbound IPv6 traffic and verify it matches the expected rules
tcpdump -nei igb0 'ip6 and tcp port 443'

# Test connectivity
ping6 2001:db8:abcd:e000::1           # LAN gateway
ping6 2001:4860:4860::8888            # External IPv6

The first command lists all IPv6 rules. The second captures actual IPv6 traffic on the WAN. The third tests both internal and external reachability.

Summary

  • IPv4 and IPv6 are independent address families in PF; rules apply only to their declared family.
  • ICMPv6 carries SLAAC, Neighbor Discovery, and PMTUD; blocking these breaks IPv6.
  • The minimum IPv6 rule set permits RS/RA/NS/NA on the LAN and essential ICMPv6 errors inbound on WAN.
  • “Block all IPv6” is not a security stance; IPv6 is enabled by default on most hosts and bypasses IPv4 rules entirely.
  • Mirror the IPv4 rule set to IPv6; audit both regularly.

Knowledge check · 4 questions

  1. Q1. You enable IPv6 on WAN and write an IPv4 firewall rule permitting inbound SSH on TCP/22. You can SSH in over IPv4 but not over IPv6. What is the most likely cause?

  2. Q2. Blocking all ICMPv6 traffic is a safe hardening posture because ICMPv6 is informational and not load-bearing for IPv6 protocol operation.

  3. Q3. Which ICMPv6 types must be permitted on the LAN for IPv6 to function correctly? Select all that apply.

  4. Q4. An operator decides to disable IPv6 firewalling entirely by writing a default-deny IPv6 rule and not configuring any other IPv6 rules. What is the most accurate assessment of this posture?

Passing score: 75%. Answers are checked in this browser.