updated: <2023-07-9>

IPv6 in OpenWRT


First make sure your internet provider has IPv6 support.


OpenWRT configuration

In OpenWRT setup add or edit interface "wan6" interface (beside regular wan for IPv4).

Protocol: DHCPv6 client
Bring up on boot: checked
Request IPv6-address: try

keep your existing IPv4 br-lan, add a new interface br6 (or set other name) as Bridge:"br-lan" with IPv6 static address.

IPv6 address: fdc2:2cf8:e49b::1/64
IPv6 gateway: copy IPv6 from wan6

IPv6 DHCP server

You may need isc-dhcp-server-ipv6 package for IPv6 DHCP server support.

configure IPv6 DHCP server for br6

Interface -> lan -> DHCP Server -> IPv6 Settings
Designated master: not checked
RA-Service: server mode
DHCPv6-Service: server mode
NDP-Proxy: hybrid mode
Learn routes: checked


https://your_openwrt_ip/cgi-bin/luci/admin/network/network

Global network options
IPv6 ULA-Prefix: fdc2:2cf8:e49b::/64


NAT rule for IPv6

You may need to a NAT rule for IPv6


https://your_openwrt_ip/cgi-bin/luci/admin/network/firewall

Name: ipv6forwawrd
Restrict to address family: IPv6 only
Procol: Any
Outbound zone: wan
Source address: any
Destination address: any
Action: MASQUERATE - Automatically

or add it manually using ip6tables-extra package (example: wlan eth0.2)

# ip6tables -t nat -A POSTROUTING -o eth0.2 -j MASQUERADE

source: https://forum.openwrt.org/t/how-to-use-ipv6-nat/100516/3

Add IPv6 supported DNS server in your "/etc/resolv.conf" and test ping6

$ ping6 ipv6_supported_domain_name

If you face routing issue you may try:

# sysctl -w net.ipv6.conf.wlanX.accept_ra=2

or dpending on your interface

# sysctl -w net.ipv6.conf.eth0/2.accept_ra=2

source: https://forum.openwrt.org/t/ipv6-nat-in-v22-03-0-rc4-with-nftables-lan-host-no-internet-packets-not-flowing-into-forward-chain/130653


for debugging you may use

# sysctl -a | grep net.ipv6 | grep accept_ra

If it works modify sysctl config

vi /etc/sysctl.d/10-default.conf


Linux network configuration example

/etc/network/interfaces

...
iface eno1 inet manual
auto br0
iface br0 inet static
   bridge_ports eno1
       address 192.168.0.103
       broadcast 192.168.0.255
       netmask 255.255.255.0
       gateway 192.168.0.1
       dns-nameservers 192.168.0.1

iface br0 inet6 static
      address fdc2:2cf8:e49b::103
      netmask 64
      gateway fdc2:2cf8:e49b::1

If you are using Gnome network manager.

IPv6 Method: Manual
Address: fdc2:2cf8:e49b::103
Prefix: 64
Gateway: fdc2:2cf8:e49b::1


Now, you will be able to access IPv6 supported websites.