Wireguard ipv6 not working in openwrt

i have setup a wireguard server on cloud with ipv6 support.
i have tested wireguard client directly using wireguard client software and both ipv4 and ipv6 works fine

i want to use it as wireguard client on openwrt.
my router got wireguard handshake but only ipv4 network can be accessed not ipv6.
my local ISP also has ipv6 and ipv6 works fine directly.
i can access ipv6 from openwrt ssh but not on LAN
it is only my router having this issue

i want the LAN to have both ipv4 and ipv6 access

uci export network; uci export dhcp; uci export firewall; netstat -lnp
package network

config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd5e:fbef:5694::/48'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth0.1'

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option ipaddr '192.168.6.1'

config device
	option name 'eth0.2'
	option macaddr '5c:a6:e6:88:ee:31'

config interface 'wan'
	option device 'eth0.2'
	option proto 'dhcp'

config interface 'wan6'
	option device 'eth0.2'
	option proto 'dhcpv6'
	option reqaddress 'try'
	option reqprefix 'auto'

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option ports '2 3 4 5 0t'

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '1 0t'

config interface 'wg0'
	option proto 'wireguard'
	option force_link '1'
	option private_key '[redacted]'
	option listen_port '[redacted]'
	list addresses '10.7.0.3/24'
	list addresses 'fddd:2c4:2c4:2c4::3/64'

config wireguard_wg0
	option public_key '[redacted]'
	option preshared_key '[redacted]'
	list allowed_ips '0.0.0.0/0'
	list allowed_ips '::/0'
	option route_allowed_ips '1'
	option endpoint_host '[redacted]'
	option endpoint_port '[redacted]'
	option persistent_keepalive '25'

package dhcp

config dnsmasq
	option domainneeded '1'
	option boguspriv '1'
	option filterwin2k '0'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option nonegcache '0'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option nonwildcard '1'
	option localservice '1'
	option ednspacket_max '1232'
	list server '/use-application-dns.net/'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'
	option dhcpv6 'server'
	option ra_slaac '1'
	list ra_flags 'managed-config'
	list ra_flags 'other-config'

config dhcp 'wan'
	option interface 'wan'
	option ignore '1'

config odhcpd 'odhcpd'
	option maindhcp '0'
	option leasefile '/tmp/hosts/odhcpd'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '4'

config dhcp 'wan6'
	option dhcpv6 'relay'
	option ra 'relay'
	option ndp 'relay'
	option master '1'
	option interface 'wan6'
	list ra_flags 'none'

package firewall

config defaults
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option synflood_protect '1'

config zone
	option name 'lan'
	list network 'lan'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'

config zone
	option name 'wan'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option masq '1'
	option mtu_fix '1'
	list network 'wan'
	list network 'wan6'

config rule
	option name 'Allow-DHCP-Renew'
	option src 'wan'
	option proto 'udp'
	option dest_port '68'
	option target 'ACCEPT'
	option family 'ipv4'

config rule
	option name 'Allow-Ping'
	option src 'wan'
	option proto 'icmp'
	option icmp_type 'echo-request'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-IGMP'
	option src 'wan'
	option proto 'igmp'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-DHCPv6'
	option src 'wan'
	option proto 'udp'
	option src_ip 'fc00::/6'
	option dest_ip 'fc00::/6'
	option dest_port '546'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-MLD'
	option src 'wan'
	option proto 'icmp'
	option src_ip 'fe80::/10'
	list icmp_type '130/0'
	list icmp_type '131/0'
	list icmp_type '132/0'
	list icmp_type '143/0'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Input'
	option src 'wan'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	list icmp_type 'router-solicitation'
	list icmp_type 'neighbour-solicitation'
	list icmp_type 'router-advertisement'
	list icmp_type 'neighbour-advertisement'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Forward'
	option src 'wan'
	option dest '*'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-IPSec-ESP'
	option src 'wan'
	option dest 'lan'
	option proto 'esp'
	option target 'ACCEPT'

config rule
	option name 'Allow-ISAKMP'
	option src 'wan'
	option dest 'lan'
	option dest_port '500'
	option proto 'udp'
	option target 'ACCEPT'

config rule
	option name 'Support-UDP-Traceroute'
	option src 'wan'
	option dest_port '33434:33689'
	option proto 'udp'
	option family 'ipv4'
	option target 'REJECT'
	option enabled 'false'

config include
	option path '/etc/firewall.user'

config zone
	option name 'wg0'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'REJECT'
	list network 'wg0'
	option masq '1'
	option mtu_fix '1'

config forwarding
	option src 'lan'
	option dest 'wg0'

config forwarding
	option src 'wg0'
	option dest 'wan'

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1816/uhttpd
tcp        0      0 192.168.6.1:53          0.0.0.0:*               LISTEN      3984/dnsmasq
tcp        0      0 10.7.0.3:53             0.0.0.0:*               LISTEN      3984/dnsmasq
tcp        0      0 192.168.0.163:53        0.0.0.0:*               LISTEN      3984/dnsmasq
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      3984/dnsmasq
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1479/dropbear
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      1816/uhttpd
tcp        0      0 :::80                   :::*                    LISTEN      1816/uhttpd
tcp        0      0 fd5e:fbef:5694::1:53    :::*                    LISTEN      3984/dnsmasq
tcp        0      0 fe80::5ea6:e6ff:fe88:ee30:53 :::*                    LISTEN      3984/dnsmasq
tcp        0      0 [redacted]:53 :::*                    LISTEN      3984/dnsmasq
tcp        0      0 fddd:2c4:2c4:2c4::3:53  :::*                    LISTEN      3984/dnsmasq
tcp        0      0 ::1:53                  :::*                    LISTEN      3984/dnsmasq
tcp        0      0 fe80::5ea6:e6ff:fe88:ee30:53 :::*                    LISTEN      3984/dnsmasq
tcp        0      0 fe80::5ea6:e6ff:fe88:ee31:53 :::*                    LISTEN      3984/dnsmasq
tcp        0      0 :::22                   :::*                    LISTEN      1479/dropbear
tcp        0      0 :::443                  :::*                    LISTEN      1816/uhttpd
udp        0      0 0.0.0.0:41211           0.0.0.0:*                           -
udp        0      0 192.168.6.1:53          0.0.0.0:*                           3984/dnsmasq
udp        0      0 10.7.0.3:53             0.0.0.0:*                           3984/dnsmasq
udp        0      0 192.168.0.163:53        0.0.0.0:*                           3984/dnsmasq
udp        0      0 127.0.0.1:53            0.0.0.0:*                           3984/dnsmasq
udp        0      0 0.0.0.0:67              0.0.0.0:*                           3984/dnsmasq
udp        0      0 :::41211                :::*                                -
udp        0      0 :::546                  :::*                                27045/odhcp6c
udp        0      0 fd5e:fbef:5694::1:53    :::*                                3984/dnsmasq
udp        0      0 fe80::5ea6:e6ff:fe88:ee30:53 :::*                                3984/dnsmasq
udp        0      0 [redacted]:53 :::*                                3984/dnsmasq
udp        0      0 fddd:2c4:2c4:2c4::3:53  :::*                                3984/dnsmasq
udp        0      0 ::1:53                  :::*                                3984/dnsmasq
udp        0      0 fe80::5ea6:e6ff:fe88:ee30:53 :::*                                3984/dnsmasq
udp        0      0 fe80::5ea6:e6ff:fe88:ee31:53 :::*                                3984/dnsmasq
raw        0      0 ::%2141855156:58        ::%4421453:*            58          27045/odhcp6c
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node PID/Program name    Path
unix  2      [ ACC ]     STREAM     LISTENING        449 676/ubusd           /var/run/ubus/ubus.sock


please help

not sure but I think you may need public, not private FD..::, addresses to be globally reachable ...

1 Like

see this i have public ipv6

root@OpenWrt:~# uci export network; uci export dhcp; uci export firewall; netstat -lnp
package network

config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd5e:fbef:5694::/48'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth0.1'

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option ipaddr '192.168.6.1'

config device
	option name 'eth0.2'
	option macaddr '5c:a6:e6:88:ee:31'

config interface 'wan'
	option device 'eth0.2'
	option proto 'dhcp'

config interface 'wan6'
	option device 'eth0.2'
	option proto 'dhcpv6'
	option reqaddress 'try'
	option reqprefix 'auto'

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option ports '2 3 4 5 0t'

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '1 0t'

config interface 'wg0'
	option proto 'wireguard'
	option force_link '1'
	option private_key ''
	option listen_port ''
	list addresses '10.7.0.3/24'
	list addresses 'fddd:2c4:2c4:2c4::3/64'

config wireguard_wg0
	option public_key ''
	option preshared_key ''
	list allowed_ips '0.0.0.0/0'
	list allowed_ips '::/0'
	option route_allowed_ips '1'
	option endpoint_host '2406:da18:74b:2c00:8459:84d3:d347:c02b'
	option endpoint_port ''
	option persistent_keepalive '25'

package dhcp

config dnsmasq
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option localservice '1'
	option ednspacket_max '1232'
	list server '/use-application-dns.net/'
	list address '/eth1-sg.flexpool.io/139.99.62.126'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'
	option dhcpv6 'server'
	option ra_slaac '1'
	list ra_flags 'managed-config'
	list ra_flags 'other-config'

config dhcp 'wan'
	option interface 'wan'
	option ignore '1'

config odhcpd 'odhcpd'
	option maindhcp '0'
	option leasefile '/tmp/hosts/odhcpd'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '4'

config dhcp 'wan6'
	option dhcpv6 'relay'
	option ra 'relay'
	option ndp 'relay'
	option master '1'
	option interface 'wan6'
	list ra_flags 'none'

package firewall

config defaults
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option synflood_protect '1'

config zone
	option name 'lan'
	list network 'lan'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'

config zone
	option name 'wan'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option masq '1'
	option mtu_fix '1'
	list network 'wan'
	list network 'wan6'

config rule
	option name 'Allow-DHCP-Renew'
	option src 'wan'
	option proto 'udp'
	option dest_port '68'
	option target 'ACCEPT'
	option family 'ipv4'

config rule
	option name 'Allow-Ping'
	option src 'wan'
	option proto 'icmp'
	option icmp_type 'echo-request'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-IGMP'
	option src 'wan'
	option proto 'igmp'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-DHCPv6'
	option src 'wan'
	option proto 'udp'
	option src_ip 'fc00::/6'
	option dest_ip 'fc00::/6'
	option dest_port '546'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-MLD'
	option src 'wan'
	option proto 'icmp'
	option src_ip 'fe80::/10'
	list icmp_type '130/0'
	list icmp_type '131/0'
	list icmp_type '132/0'
	list icmp_type '143/0'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Input'
	option src 'wan'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	list icmp_type 'router-solicitation'
	list icmp_type 'neighbour-solicitation'
	list icmp_type 'router-advertisement'
	list icmp_type 'neighbour-advertisement'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Forward'
	option src 'wan'
	option dest '*'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-IPSec-ESP'
	option src 'wan'
	option dest 'lan'
	option proto 'esp'
	option target 'ACCEPT'

config rule
	option name 'Allow-ISAKMP'
	option src 'wan'
	option dest 'lan'
	option dest_port '500'
	option proto 'udp'
	option target 'ACCEPT'

config rule
	option name 'Support-UDP-Traceroute'
	option src 'wan'
	option dest_port '33434:33689'
	option proto 'udp'
	option family 'ipv4'
	option target 'REJECT'
	option enabled 'false'

config include
	option path '/etc/firewall.user'

config zone
	option name 'wg0'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'REJECT'
	list network 'wg0'
	option masq '1'
	option mtu_fix '1'

config forwarding
	option src 'lan'
	option dest 'wg0'

config forwarding
	option src 'wg0'
	option dest 'wan'

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1816/uhttpd
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      10442/dnsmasq
tcp        0      0 192.168.0.163:53        0.0.0.0:*               LISTEN      10442/dnsmasq
tcp        0      0 192.168.6.1:53          0.0.0.0:*               LISTEN      10442/dnsmasq
tcp        0      0 10.7.0.3:53             0.0.0.0:*               LISTEN      10442/dnsmasq
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1479/dropbear
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      1816/uhttpd
tcp        0      0 :::80                   :::*                    LISTEN      1816/uhttpd
tcp        0      0 2001:4490:4e5d:89ed:5ea6:e6ff:fe88:ee31:53 :::*                    LISTEN      10442/dnsmasq
tcp        0      0 ::1:53                  :::*                    LISTEN      10442/dnsmasq
tcp        0      0 fe80::5ea6:e6ff:fe88:ee30:53 :::*                    LISTEN      10442/dnsmasq
tcp        0      0 fe80::5ea6:e6ff:fe88:ee31:53 :::*                    LISTEN      10442/dnsmasq
tcp        0      0 fe80::5ea6:e6ff:fe88:ee30:53 :::*                    LISTEN      10442/dnsmasq
tcp        0      0 fd5e:fbef:5694::1:53    :::*                    LISTEN      10442/dnsmasq
tcp        0      0 fddd:2c4:2c4:2c4::3:53  :::*                    LISTEN      10442/dnsmasq
tcp        0      0 :::22                   :::*                    LISTEN      1479/dropbear
tcp        0      0 :::443                  :::*                    LISTEN      1816/uhttpd
udp        0      0 0.0.0.0:41211           0.0.0.0:*                           -
udp        0      0 127.0.0.1:53            0.0.0.0:*                           10442/dnsmasq
udp        0      0 192.168.0.163:53        0.0.0.0:*                           10442/dnsmasq
udp        0      0 192.168.6.1:53          0.0.0.0:*                           10442/dnsmasq
udp        0      0 10.7.0.3:53             0.0.0.0:*                           10442/dnsmasq
udp        0      0 0.0.0.0:67              0.0.0.0:*                           10442/dnsmasq
udp        0      0 :::41211                :::*                                -
udp        0      0 :::546                  :::*                                27045/odhcp6c
udp        0      0 :::547                  :::*                                1696/odhcpd
udp        0      0 2001:4490:4e5d:89ed:5ea6:e6ff:fe88:ee31:53 :::*                                10442/dnsmasq
udp        0      0 ::1:53                  :::*                                10442/dnsmasq
udp        0      0 fe80::5ea6:e6ff:fe88:ee30:53 :::*                                10442/dnsmasq
udp        0      0 fe80::5ea6:e6ff:fe88:ee31:53 :::*                                10442/dnsmasq
udp        0      0 fe80::5ea6:e6ff:fe88:ee30:53 :::*                                10442/dnsmasq
udp        0      0 fd5e:fbef:5694::1:53    :::*                                10442/dnsmasq
udp        0      0 fddd:2c4:2c4:2c4::3:53  :::*                                10442/dnsmasq
raw        0      0 ::%2144037364:58        ::%4421453:*            58          27045/odhcp6c
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node PID/Program name    Path
unix  2      [ ACC ]     STREAM     LISTENING        449 676/ubusd           /var/run/ubus/ubus.sock
root@OpenWrt:~# package network

Where?

Your local Wireguard interface doesn't even possess a public IPv6 address.

You've only setup your OpenWrt to reach your peer on an IPv6 address thru the tunnel. I should also note that won't work unless you have a valid IP on the OpenWrt and place a route on the peer.

:spiral_notepad: You cannot use dynamic IP addressing for Wireguard. So if you're referring to wan6 as you source of IPv6 addresses, that won't work

1 Like

this is my wireguard conf file.
i tried directly on windows, android etc.. i am able to access both ipv4 & ipv6 network easily.

i am having this issue only on openwrt.
wireguard assigns local ipv6 ip fddd:2c4:2c4:2c4::3/64 for the interface
while the access endpoint is public ipv6 2406:da18:74b:2c00:8459:84d3:d347:c02b

[Interface]
Address = 10.7.0.3/24, fddd:2c4:2c4:2c4::3/64
DNS = 1.1.1.1, 1.0.0.1
PrivateKey = kMc0kgbJ5vIgM/DWUUpQAJoxhYB/b+MhLIWFz2jnM2w=

[Peer]
PublicKey = RueDdOFTp/XAuFx3Kmk3bg8nYwI55Mc1kf+2xqwiU2k=
PresharedKey = jRULsQwIvCjdN2eBR8/4VSog3HvwzXGQpcJOFnQDDr4=
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = [2406:da18:74b:2c00:8459:84d3:d347:c02b]:41211
PersistentKeepalive = 25
root@ip-172-26-5-219:/home/ubuntu# 

i am using lightsail instance for running wireguard server
https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-enable-disable-ipv6

I was not able to access wan6 directly earlier, hence to make lan access ipv6 i had to set openwrt in ipv6 relay mode
but the problem is i dont know how to make it work when wireguard comes in between

???

You need a Public IP.

???

I see no Wireguard Public IP. It appears you're connecting to the tunnel on wan6. That's the only IPv6 I see.

wan6 has a /64 address and no delegated prefix. If you are connected to an upstream ISP router verify that it can delegate a prefix. Otherwise you can use ipv6 relay.

2 Likes

my isp give only one /64 per customer, which makes it impossible to subnet.
so i will use ipv6 relay for WAN6 on openwrt

and for wireguard with AWS cloud instance, they don't provide /48 ipv6 subnet, hence cannot act as a upstream router.
this was just for my learning purpose, i tried a 6in4 tunnel and it worked

thanks for your help

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.