Rewriting dns in relay mode in odhcpd

The odhcpd documentation mentions that it "Supports rewriting of the announced DNS server addresses" in relay mode. However, it is not clear on how to achieve that.

After trying out a bunch of things, and ultimately going through the source of odhcpd I figured out that if dns option is specifically mentioned in the dhcp config for the interface (either ipv6 or ipv4), it overrides the upstream dns with preffered ipv6 dns server of the router. It would be helpful if this was mentioned in the documentation somewhere.

Changing behaviour based on if the dns is specified or not is also not intuitive. The default value of dns option is the local address, but specifically specifying the same local address changes the behavior in this case.

Link to the documentation I'm referring to: https://openwrt.org/docs/techref/odhcpd

2 Likes

I have run into this same issue. Thanks for posting, at least I know I'm not just doing something wrong.

Thank you very much for that hint! It helped me a lot to make my nat64-gateway (jool based, I call it ipv4-remover) also running in relay mode.

It is very pity that the combination of relay mode and change of the resolver dns is not possible to set with the luci gui.