Solved: IPv6 relay doesn’t work with /64 network, not even from router

I tether my phone either by usb or wifi. I get the following ip's assigned:

IPv6: 2600:10*****:fe0b:c9dc/64  
IPv4: 192.168.184.88/24

Since I got only a fe80: ipv6 assigned on the computer I applied all changes form https://openwrt.org/docs/guide-user/network/ipv6/configuration#ipv6_relay

ipv4 works without problems and when I tether the computer directly with the phone with wifi I have ipv4 and ipv6 working.

uci export network:

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 'fd12:a489:73af::/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 ipaddr '192.168.150.1'
	option ip6assign '64'

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

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option ports '6t'

config interface 'hwan'
	option proto 'dhcp'
	option device 'wlan0'

config interface 'hwan6'
	option proto 'dhcpv6'
	option device 'wlan0'
	option reqaddress 'try'
	option reqprefix 'auto'

config switch_vlan
	option device 'switch0'
	option ports '4 6t'
	option vlan '2'

config interface 'twan'
	option proto 'dhcp'
	option device 'usb0'

config device
	option name 'usb0'

config interface 'twan6'
	option proto 'dhcpv6'
	option device 'usb0'
	option reqaddress 'try'
	option reqprefix 'auto'

uci export dhcp

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'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'
	option ra 'relay'
	option ndp 'relay'
	option dhcpv6 'relay'

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 'hwan6'
	option interface 'hwan6'
	option ra 'relay'
	option dhcpv6 'relay'
	option ndp 'relay'

config dhcp 'twan6'
	option interface 'twan6'
	option master '1'
	option ra 'relay'
	option ndp 'relay'
	option dhcpv6 'relay'

Now I get some ipv6 ip's on my computer:

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.150.140  netmask 255.255.255.0  broadcast 192.168.150.255
        inet6 2600:10*****:848e:b1b3  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::680b:e027:bea2:1661  prefixlen 64  scopeid 0x20<link>
        ether c8:e2:65:6b:bc:32  txqueuelen 1000  (Ethernet)

But when I try ping6 google.com on the router I get only

PING google.com (2607:f8b0:4005:813::200e): 56 data bytes

and ping -6 google.com on the computer it takes very long to resolve the address and I get only

PING google.com(fra24s02-in-x0e.1e100.net (2a00:1450:4001:803::200e)) 56 Datenbytes

and in both cases all packets are lost.

I even tried NAT66 according to https://openwrt.org/docs/guide-user/network/ipv6/ipv6.nat6 but I reverted all changes since it wasn't working either.

I have no idea what to do next since I have no clues about ipv6.

Any help would be greatly appreciated.

Stupid me!

I removed the interface twan6 and the twan6 dhcp configuration and made hwan6 the master. Now I can tether via usb, but only ipv4, and via wifi, both ipv4 and ipv6. Not exactly what I was hoping for but at least I have one working solution.

1 Like

USB should also work with ipv6 if you change everything about the WAN over from wifi to USB. It's a bit indeterminate what happens when duplicate wans are defined but only one is connected.

The settings that I have been using are slightly different, on the LAN (slave) I set dhcpv6 to server with the other_config flag set to advertise DNS (which will be the lan interface's link-local IPv6). Other than that, dhcpv6 doesn't really apply to a relay scenario, it is all SLAAC. I do not put any dhcpv6 relay setting in the wan6 (master) interface.

The problem I've been having is that sometimes wan6 picks up a GUA in the /64 as it should, and sometimes it does not. This doesn't prevent relayed endpoints from working, but local Internet usage from OpenWrt such as NTP and upgrades will not work.

Thank you @mk24 for your quick response.

What I read the problem is the /64 address I get. Because of that I must use IPv6 relay. Since without IPv6 relay I had no ipv6 at all.

I use the router in our RV and had 3 WAN defined. One for usb, one for wifi and one for lan (wifi booster antenna). I deleted that configuration when I upgraded to the latest release of OpenWrt. Depending on what I was using one of the three WAN was active while the two other showed nothing connected.

This worked fine when I was using only ipv4 but now i decided to include ipv6 and it doesn't work any longer. Because the IPv6 relay requires the active WAN to be dhcpv6 master and I can set master only for one WAN.

Sadly I don't know that much about networking at all and even less about ipv6. So I don't know what you are talking about. Does it mean on LAN dhcpv6 = server and ra = ndp = relay; and TWAN and HWAN deleted from dhcp (i.e. no dhcpv6 settings at all)?

Would this apply to my use case?

I don't care much about local internet usage from OpenWrt. I need only the connected devices to be able to use ipv4 and ipv6.

Yes I was saying to delete or disable the WAN networks that you're not using. Or what I do is have one WAN defined but change its physical device (eth, usb, or wifi) depending on the type of connection that is actually in use.

In /etc/config/network, set up a v4 and a v6 wan.

config interface 'wan'
    option device 'usb0'
    option proto 'dhcp'

config interface 'wan6'
    option device '@wan'
    option proto 'dhcpv6'

A couple of points here, first the @wan device means to alias whatever device is configured to wan to be used as wan6 as well. So you only need to change the device once. Except if the device is a wifi client (STA), use option network 'wan' in /etc/config/wireless and have no device in /etc/config/network. Second is that option proto dhcpv6 in the network config means to use either RA SLAAC if that is all that is available, or also try dhcpv6. There is no option proto that is SLAAC only but there are other options if you really wanted to force that. For connection to a variety of upstream networks try the simplest: fully auto first.

In /etc/config/dhcp the relevant IPv6 settings are

config dhcp 'wan6'
    option master '1'
    option ra 'relay'
    option ndp 'relay'

config dhcp 'lan'
... (ipv4 stuff)
    option ra 'relay'
    option ndp 'relay'
    option dhcpv6 'server'
    list ra_flags 'other-config'

Thank you @mk24 for your explanations. But having only one wan doesn't fit my use case. I want to use tethering via usb / wifi / lan without re-configuring the router. Just connecting the device I want to use for tethering and having internet without any configuration. Most of the time I will use tethering via wifi and because of that it is good to have ipv4 and ipv6 available there. If I have to use tethering via usb or lan I prefer to use only ipv4 instead of having to re-configure the router every time.

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