Using IPv6 RDNSS option with RA relay mode - is it possible?

Hi! I have OpenWrt 22.03.0 running on a Linksys E8450, but my ISP only advertises a /64 IPv6 prefix to it using SLAAC, while things like DNS servers and NTP servers get advertised through DHCPv6.

I got my devices in the LAN connected to the IPv6 internet by configuring LAN to use "relay mode" for RA-Service, DHCPv6-Service as "server mode" with "Local IPv6 DNS server" enabled, and NDP-Proxy as "relay mode". WAN6 has "relay mode" for all three of those, but it's also specified as the "Designated master".

Now, I want to advertise an IPv6 DNS server - the router itself - to Android devices, so I also want to use the RA RDNSS option (RFC 6106). However, I simply cannot find a way to do so when RA-Service is in relay mode. Any idea as to how I could accomplish that, or is it just not possible?

Have you tried the hybrid mode?

Yes, but it didn't change anything because a designated master interface is configured. Not configuring a designated master interface didn't allow IPv6 to work at all.

Then the other option would be to stop relay and do a NAT6.

I see... That's not exactly ideal, though I suppose neither is Android not supporting DHCPv6, nor is my ISP only issuing a /64 prefix.
A feature to advertise DNS with RDNSS option even when RA relay mode is enabled would be nice, but would there be any reason why that's a bad idea? My previous router (YAMAHA NVR510, not OpenWrt) was able to do that just fine, though it could only advertise the DNS server it received from upstream through either DHCPv6 or RDNSS option, regardless of the prefix length.

I am not saying it is a bad idea, but how many users are facing the same combination of issues as you do? I cannot think of another use-case that someone would need such a specific need. And if there is not a big demand for a feature, it won't attract the developers' attention.

Fair enough. Maybe it'll become a wider issue if things start to go fully IPv6-only, but for now the configuration I have here right now works fine as is. Thanks anyways!

Hold up, the docs for odchpd say this:

RD Relay mode: Router Discovery (RD) relay between master and slave interfaces.

Supports rewriting of the announced DNS server addresses.

(bold mine)
This seems like it's what I'm looking for. Do I need to configure something for it to work?

Nothing is documented, hence you could try to add some IPv6 address in DNS option and see if that works.

I dug through the odhcpd source code and found that it does in fact rewrite the DNS, but only under the condition that interface->always_rewrite_dns is true. By the looks of it (and please correct me if I'm wrong), always_rewrite_dns is left over from 6relayd and there seems to be no way at the moment to enable it from UCI in 22.03.0. Whoops, looks like it's always enabled when DNS server(s) are specified, according to this. I specified the DNS servers in "Use custom DNS servers" for the LAN interface in LuCI though, and it doesn't seem to be working for either DHCPv6 or RA RDNSS option...

If you have Linux client devise install radvdump and check if you really got rdnss.

If odhcpd should not send it you could try to install ravd or bird an the OpenWrt and send only the rdnss... But of course the better option would be to understand what piece is missing here.

Right, so I tried using radvdump, and my Linux PC is in fact not receiving any RAs with RDNSS option. Judging by the source code, I think what's going on here is that odhcpd only rewrites, and doesn't newly write RDNSS option to RAs. The router is only receiving RAs from upstream WAN with SLAAC and nothing more, so of course it can't do any rewriting.
I'm not sure why the router isn't rewriting the DNS in DHCPv6 though... According to tcpdump, my Linux PC doesn't seem to be receiving DHCPv6 packets at all for that matter, even though the relayed RAs received by it have the "other config" flag enabled, and my Linux PC appears to be sending DHCPv6 solicit messages. At least I can deal with that by putting DHCPv6 in server mode though.

Is any progress in this topic?

I have a similar problem. I use the ipv4-remover. It works in PD-mode beautifully. But in relay mode I cant change the RDNSS nor set the option ra_pref64 '64:ff9b::/96' .
Relaying without any chance to change some parameters has not much effect, except maybe the firewall rules.

If odhcp does not send the DNS option you could maybe use radv to only send that option without any prefix or default route etc. and btw it's kind of confusing to name something "IPv4 remover" and then linking to the Kool page of Openwrt....

The first sentence does not help me further.

Sorry for confusing you by using the term ipv4-remover, but that is the purpose of jool.

:person_shrugging: I simply made a offer how to achieve your goal. You could dump odhcpd altogether too; or write a bug report/feature request.

Pardon me, but never and nowhere I have seen a) this term and b) in the context of jool. jool is no "ipv4 remover" it is a NAT64 implementation, in this case a kernel module. It does not remove anything IPv4 related. It translate between ipv4 and ipv6. Please show me where the term is used, otherwise please do not create such (silly) terms. What jool is doing has a name, an established name: NAT64.

1 Like

I found the solution here https://forum.openwrt.org/t/rewriting-dns-in-relay-mode-in-odhcpd/120574/1

I haven't found a package called radv.
odhcp does it well, just luci is hiding that feature.

Mhm it seams radvd is not any longer present in the main feed, which is sad.
How ever, bird is also totally fine to handle RA: https://bird.network.cz/?get_doc&v=20&f=bird-6.html#ss6.14

I'm even more confused... As in the other thread: there is atm no "solution" to set or rewrite RDNSS with odhcpd, at least you say so; but in this thread you say its possible...

btw: as you still insist that jool "removes" something, you now get my daily bonus points to find a fix for something; talk public about that you have found the fix; but don't mind to share HOW you have done done. :+1: /s

Ok, I use stateful NAT64, alias SIIT+NAT4. Yes I insist of removing IPv4 - the WAN side is dualstacked, the LAN is IPv6only. The difference is removed IPv4. (I disable DHCPv4 also on LAN)
After being happy, that it works in general, I run into problems with the relay mode.
I will investigate it by higher loglevels and maybe Wireshark, if possible. Android starts clat as usual (to reenable local ipv4 sockets), but 464xlat doesn't work anymore.

my ISP uses CGnat with IPv6. The router does not provide Prefix Delegation and I cannot change the DNS. I have OpenWrt connected behind this Router. I use NAT (192.168.0.1/24) on IPv4. I use RA-relay, DHCPv6-relay, NDP-relay for IPv6. The web interface does not allow you to change DNS for IPv6. By changing /etc/config/dhcp I was able to do it. But be careful, every change of the interface in Luci cancels this setting.
At home I have Windows laptops, Linux, Android phones, Zigbee, RoboRock, Washer and dryer with wifi, all devices work without problems with IPv6 and my DNS.

/etc/config/dhcp

config dhcp 'lan'
        option interface 'lan'
        option leasetime '12h'
        ### IPv4 ###
        option dhcpv4 'server'
        option force '1'
        option start '150'
        option limit '49'
        list dhcp_option '6, 45.90.28.67, 45.90.30.67'
        ### IPv6 ###
        option dhcpv6 'relay'
        option ndp 'relay'
        option ra 'relay'
        option ra_dns '0'
        option dns '2a07:a8c0::b4:5da1 2a07:a8c1::b4:5da1'

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

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