OpenBSD Handbook

    Theme
    • Part I. Install & Configure
      • Introduction
      • Installing OpenBSD
      • The X Window System
      • Networking
      • System Configuration
      • OpenBSD Basics
      • Managing Software: Packages and Ports
    • Part II. Daily Operations
      • Graphical Environments
      • Multimedia
      • Printing
      • Linux Compatibility
      • Windows Compatibility
      • Games
    • Part III. System Administration
      • Virtualization
      • Storage and File Systems
      • Updating and Upgrading
      • Localization
      • The OpenBSD Boot Process
      • Security
    • Part IV. Networking & Daemons
      • Services
        • Database
          • MariaDB
          • PostgreSQL
          • Redis
          • memcached
        • Directory
          • YP (NIS)
          • LDAP
        • File
          • NFS
          • Samba
        • FTP Services
          • ftpd
          • ProFTPD
          • vsftpd
          • Pure-FTPd
          • TFTP
        • Mail
          • smtpd
          • Dovecot
          • Postfix
          • Exim
          • Rspamd
        • Name
          • Unbound
          • NSD
          • BIND
        • Networking
          • OpenBGPD
          • rad
          • DHCP
          • slaacd
        • Web
          • Apache
          • nginx
          • httpd
          • relayd
        • Logging
          • syslogd
        • Monitoring
          • SNMP
        • Remote Access
          • Audit OpenSSH
          • sshd
        • File Synchronization
          • rsync
        • Messaging
          • RabbitMQ
        • Time
          • NTP
      • PF
        • pfctl cheat sheet
        • PF Anchors
        • PF Filter Rules
        • PF Forwarding
        • PF Lists and Macros
        • PF Load Balancing
        • PF Logging
        • PF NAT
        • PF Options
        • PF Policies
        • PF Shortcuts
        • PF Tables
      • Advanced Networking
        • High Availability and State Replication
        • Multi-WAN and Policy-Based Routing
        • VPN and Cryptographic Tunneling
        • Classic and Lightweight Tunnels
        • IPv6 at Scale
        • QoS and Traffic Shaping
        • MPLS and Label Distribution
        • Network Services at Scale
        • Virtualization and Host Networking
        • Large-Scale L2 and L3 Design
        • Telemetry, Logging, and Flow Export
        • Hardening and Operational Safety
        • Reference Architectures
        • Troubleshooting Playbooks
      • Serial Communication
    • Part V. Miscellaneous
      • Virtualization Cheat Sheet
      • OpenBSD Cheatsheet
      • How-to Guides
        • Complete the First 30 Minutes After Installation
        • Check Hardware Compatibility Before Installing
        • Bootstrap Wi-Fi Firmware Without Ethernet
        • Set Up OpenBSD as a Laptop or Workstation
        • Configure Laptop Power Management
        • Run OpenBSD as a Virtual Machine Guest
        • Install OpenBSD on a VPS or Cloud Server
        • Install OpenBSD with Full-Disk Encryption
        • Troubleshoot Web Browsers on OpenBSD
        • Create an Administrator Account with doas and SSH Keys
        • Establish a Conservative Security Baseline
        • Manage OpenBSD with Ansible
        • Recover Access and Reset the Root Password
        • Collect OpenBSD Diagnostic Evidence
        • Configure Secure Remote Access with OpenSSH
        • Set Up WordPress
        • Build Third-Party Software from Ports
        • Use FIDO Security Keys with OpenSSH
        • Build OpenBSD from Source
        • Configure Wi-Fi Roaming and Wired Failover
        • Dual-Boot OpenBSD on a UEFI System
        • Troubleshoot PF, NAT, and Routing
        • Automate OpenBSD Installation with Autoinstall and PXE
        • Route Multiple VLANs with PF
        • Configure a Road-Warrior WireGuard VPN
        • Troubleshoot Package Installation and Update Failures
        • Route IPv6 Networks without NAT
        • Schedule Recurring Maintenance
        • Plan a Docker Workload Migration to OpenBSD
        • Build a Mail Server with OpenSMTPD, Dovecot, and Rspamd
        • Build a Simple Router and Firewall
        • Monitor an OpenBSD System
        • Back Up and Restore an OpenBSD System
        • Configure softraid RAID1
        • Recover an OpenBSD System That Does Not Boot
        • Install Z shell (zsh)
      • OpenBSD for Linux Users
      • OpenBSD for FreeBSD Users
      • OpenBSD for macOS Users
    • OpenBSD FAQ
    • Package Search
      • Synopsis
      • Example Topology
      • Configure Static IPv6 Addresses
      • Enable IPv6 Forwarding
      • Advertise the LAN Prefix
      • Add an IPv6 PF Policy
      • Verify from a LAN Client
      • Troubleshooting Boundaries

      Route IPv6 Networks without NAT

      Synopsis #

      Native IPv6 routing assigns a globally routed prefix to each internal network. It does not require network address translation. This guide configures one OpenBSD router with a static upstream, one internal /64, rtadvd(8) router advertisements, and an explicit Packet Filter policy.

      The upstream provider must route a prefix to the OpenBSD system. A single on-link address or one SLAAC address does not imply that an additional LAN prefix is available. Confirm the routed-prefix size, next hop, and reverse-routing behavior before making changes.

      Example Topology #

      The example uses documentation prefixes:

      RoleValue
      WAN interfaceem0
      WAN address2001:db8:100::2/64
      WAN next hopfe80::1%em0
      Delegated prefix2001:db8:200::/48
      LAN interfaceem1
      LAN prefix2001:db8:200:10::/64
      Router LAN address2001:db8:200:10::1

      Never deploy 2001:db8::/32; it exists only for documentation.

      Configure Static IPv6 Addresses #

      Add the upstream address to /etc/hostname.em0 without discarding existing IPv4 or link settings:

      inet6 2001:db8:100::2 64
      

      Configure /etc/hostname.em1:

      inet6 2001:db8:200:10::1 64
      up
      

      Place the IPv6 default gateway on its own line in /etc/mygate, preserving any existing IPv4 gateway:

      fe80::1%em0
      

      Apply the complete network configuration with netstart(8) :

      # sh /etc/netstart
      

      Confirm both addresses and the default route:

      $ ifconfig em0 inet6
        # Confirm the WAN global and link-local addresses
      $ ifconfig em1 inet6
        # Confirm the LAN /64
      $ route -n show -inet6
        # Confirm connected routes and the IPv6 default route
      

      Enable IPv6 Forwarding #

      Add the following line to /etc/sysctl.conf:

      net.inet6.ip6.forwarding=1
      

      Apply it immediately with sysctl(8) :

      # sysctl net.inet6.ip6.forwarding=1
      

      Do not enable IPv4 forwarding unless the host also has an intentional IPv4 routing policy.

      Advertise the LAN Prefix #

      rtadvd(8) can advertise prefixes derived from the configured LAN interface. Limit it to interfaces that face managed client networks:

      # rcctl set rtadvd flags em1
        # Advertise only on the LAN interface
      # rcctl enable rtadvd
        # Start the daemon during boot
      # rcctl start rtadvd
        # Begin sending router advertisements
      

      The daemon must not advertise on the upstream interface. More complex lifetimes, DNS information, or prefix behavior require an explicit /etc/rtadvd.conf reviewed against rtadvd.conf(5) .

      Add an IPv6 PF Policy #

      IPv6 depends on ICMPv6 for neighbor discovery, path MTU discovery, error reporting, and address configuration. Do not apply an IPv4 policy that blocks ICMPv6 indiscriminately.

      Integrate this minimal policy with the complete /etc/pf.conf:

      wan = "em0"
      lan = "em1"
      lan6 = "2001:db8:200:10::/64"
      
      block inet6 all
      pass inet6 proto icmp6
      pass in on $lan inet6 from $lan6 to any
      pass out on $wan inet6 from $lan6 to any
      

      This policy permits LAN-initiated traffic and its stateful replies. It does not publish inbound services from the Internet. Parse before loading:

      # pfctl -nf /etc/pf.conf
        # Check the complete policy without changing it
      # pfctl -f /etc/pf.conf
        # Load only after the syntax check succeeds
      

      No nat-to rule is required. If internal addresses are not reachable from the Internet, correct provider routing, prefix allocation, local routes, or PF policy instead of adding NAT66.

      Verify from a LAN Client #

      After receiving a router advertisement, the client should have a global address in the LAN /64, a link-local address, and an IPv6 default route. Test in order:

      $ ifconfig
        # Confirm the client global IPv6 address
      $ route -n show -inet6
        # Confirm the default route learned from the router
      $ ping6 2001:db8:200:10::1
        # Test the LAN router address
      $ ping6 2001:db8:100::2
        # Test the router WAN address
      $ traceroute6 openbsd.org
        # Test the routed Internet path
      

      On the router, inspect neighbor discovery and packets:

      $ ndp -a
        # Confirm the client neighbor entry
      # tcpdump -ni em1 icmp6
        # Observe advertisements and neighbor discovery
      # tcpdump -ni em0 ip6
        # Observe forwarded upstream traffic
      

      Troubleshooting Boundaries #

      • No global client address usually indicates an advertisement, prefix, interface, or client-autoconfiguration problem.
      • A client can reach the router but not the Internet when forwarding, PF, the default route, or upstream routing is wrong.
      • Outbound packets visible on the WAN with no replies often indicate that the provider does not route the delegated prefix back to the router.
      • Small transfers that work while larger ones stall can indicate broken ICMPv6 Packet Too Big delivery.
      • DNS failure is separate from IPv6 routing. Test literal IPv6 addresses before changing resolver configuration.

      See IPv6 at Scale for multi-prefix and routed-network design.

      Report a bug
      • Synopsis
      • Example Topology
      • Configure Static IPv6 Addresses
      • Enable IPv6 Forwarding
      • Advertise the LAN Prefix
      • Add an IPv6 PF Policy
      • Verify from a LAN Client
      • Troubleshooting Boundaries