OpenWrt has comprehensive IPv6 support built in. Addresses can be obtained via DHCPv6 or SLAAC, distributed to LAN clients through prefix delegation, or tunnelled over IPv4 using several standardised mechanisms.
IPv6 address acquisition methods
| Method | Protocol value | Description |
|---|
| DHCPv6 client | dhcpv6 | Request address and/or prefix from an upstream DHCPv6 server |
| SLAAC | Automatic | Stateless address auto-configuration via Router Advertisements |
| Static | static | Manually configured ip6addr and ip6gw |
| 6in4 tunnel | 6in4 | IPv6-in-IPv4 static tunnel to a Hurricane Electric / SixXS broker |
| 6to4 | 6to4 | Automatic 6-to-4 tunnel (RFC 3056); requires a public IPv4 address |
| 6rd | 6rd | IPv6 Rapid Deployment (ISP-provisioned tunnel) |
| DS-Lite | dslite | Dual-Stack Lite: IPv4-in-IPv6 for ISPs deploying CGN |
Key packages
| Package | Role |
|---|
odhcp6c | DHCPv6 client — runs on the WAN interface to obtain a prefix |
odhcpd | DHCPv6 server + Router Advertisement daemon — serves LAN clients |
6in4 | netifd protocol handler for static IPv6-in-IPv4 tunnels |
6to4 | netifd protocol handler for automatic 6to4 tunnels |
ds-lite | netifd protocol handler for DS-Lite |
Enabling DHCPv6 on the WAN interface
Add or modify the wan6 interface in /etc/config/network:
config interface 'wan6'
option device eth0
option proto dhcpv6
For ISPs that provision both the address and a delegated prefix in the same DHCPv6 exchange, use reqprefix to specify the desired prefix length:
config interface 'wan6'
option device eth0
option proto dhcpv6
option reqaddress try
option reqprefix auto
| Option | Values | Description |
|---|
reqaddress | try, force, none | Whether to request a IA_NA (non-temporary address) |
reqprefix | auto, no, or prefix length (48–64) | Whether to request a IA_PD (delegated prefix) |
ifaceid | IPv6 suffix | Interface identifier to append to delegated prefixes |
Prefix delegation (PD)
Prefix delegation allows the WAN DHCPv6 client to receive a large prefix (e.g. /56 or /48) from the ISP and sub-delegate smaller prefixes (typically /64) to each LAN interface. odhcpd handles this automatically.
Ensure the LAN dhcp section in /etc/config/dhcp references the correct interface:
config dhcp 'lan'
option interface lan
option start 100
option limit 150
option leasetime 12h
option dhcpv6 server
option ra server
option ra_slaac 1
list ra_flags managed-config
list ra_flags other-config
odhcpd will automatically pick up the delegated prefix from wan6 and announce it in Router Advertisements on lan.
odhcpd — server configuration
odhcpd is configured through the dhcp.odhcpd UCI section in /etc/config/dhcp:
config odhcpd 'odhcpd'
option maindhcp 0
option leasefile /tmp/odhcpd.leases
option leasetrigger /usr/sbin/odhcpd-update
option loglevel 4
| Option | Description |
|---|
maindhcp | Set to 1 if odhcpd handles both DHCPv4 and DHCPv6 (no dnsmasq) |
leasefile | Path where active leases are written |
leasetrigger | Script called when leases change |
loglevel | Syslog level (0 = emergency … 7 = debug) |
6in4 static tunnel
For a Hurricane Electric (he.net) or similar broker tunnel:
config interface 'henet'
option proto 6in4
option peeraddr 192.0.2.1
option ip6addr 2001:db8::2/64
option ip6prefix 2001:db8:1::/48
option tunnelid 12345
option username 'user@example.com'
option password 'tunnelpassword'
| Option | Description |
|---|
peeraddr | IPv4 address of the tunnel server |
ip6addr | Your tunnel endpoint IPv6 address |
ip6prefix | Routed prefix assigned to you |
tunnelid | Broker tunnel ID (for dynamic endpoint updates) |
IPv6 firewall considerations
OpenWrt’s firewall configuration already includes the essential ICMPv6 rules required for IPv6 to function correctly. These are present in the default /etc/config/firewall:
Do not block ICMPv6 on the WAN zone. Neighbour Discovery, Router Advertisements, and Path MTU Discovery all rely on ICMPv6. The default firewall rules allow the required types while rate-limiting them.
Key default rules that must remain active:
| Rule name | Traffic | Why it is needed |
|---|
Allow-DHCPv6 | UDP port 546 from fe80::/10 | Allows DHCPv6 replies from the ISP router |
Allow-MLD | ICMPv6 types 130–132, 143 | Multicast Listener Discovery for IPv6 multicast |
Allow-ICMPv6-Input | Essential ICMPv6 types | NDP, echo, unreachable, too-big, time-exceeded |
Allow-ICMPv6-Forward | Essential ICMPv6 types (forwarded) | Allows LAN hosts to receive ICMPv6 from WAN |
To add a custom IPv6 firewall rule that blocks all traffic from a specific prefix:
config rule
option name Block-Bad-Prefix
option src wan
option src_ip 2001:db8:bad::/48
option target DROP
option family ipv6
Verifying IPv6 connectivity
# Check assigned addresses
ip -6 addr show
# Check IPv6 routes
ip -6 route show
# Test connectivity to a well-known IPv6 address
ping6 2606:4700:4700::1111
# Check netifd interface state
ubus call network.interface.wan6 status