I'm trying to configure openwrt to intercept all lan DNS requests and redirect them to local DNS.
I'm using the configuration documented in https://openwrt.org/docs/guide-user/firewall/fw3_configurations/intercept_dns#command-line_instructions
This is my /etc/config/firewall
:
config redirect 'dns_int'
option name 'Intercept-DNS'
option src 'lan'
option src_dport '53'
option proto 'tcp udp'
option target 'DNAT'
option family 'any'
With this configuration it seems using ipv4 DNS requests both to local DNS server and external DNS server are properly handled and external ones are redirected to local one.
❯ dig +short www.google.com @192.168.1.1
216.58.211.196
❯ dig +short www.google.com @1.1.1.1
216.58.211.196
On the other hand, DNS requests over ipv6 seem to fail:
❯ dig +short www.google.com @fdb7:ff**:****::1 # Lan dns
;; connection timed out; no servers could be reached
❯ dig +short www.google.com @2606:4700:4700::1111 # External dns
;; connection timed out; no servers could be reached
If I disable the dns_int
firewall rule, DNS requests over ipv6 work with no problem:
❯ dig +short www.google.com @fdb7:ff**:****::1
172.217.171.196
❯ dig +short www.google.com @2606:4700:4700::1111
142.251.37.36
Of course, if I disable firewall rule, DNS requests are not intercepted nor redirected to local one.
What could I do to debug and fix the problem? Isn't this documented configuration supposed to work with both ipv4 and ipv6?