ColinTaylor
Part of the Furniture
Hi John. This seems to work.It could probably be implemented on my fork
- Would have to double check if the stubby config supports multiple listening ports to be able to support both router and DNSFilter queries
- Only for ARM routers (need to nat to localhost which isn't supported on the MIPS kernel, I had to patch the ARM kernel to support it and you need to activate it with a kernel write to /proc)
- Those clients would be like any DNSFilter client, and couldn't use things like Diversion
As you predicated it didn't work when I tried to DNAT the queries to 127.0.0.1. I didn't pursue this any further and instead just DNATed to 192.168.1.1:5453 instead. This required one extra line in stubby.yml:
Code:
listen_addresses:
- 127.0.0.1@5453
- 192.168.1.1@5453
Code:
# netstat -npa | grep stubb
tcp 0 0 192.168.1.1:5453 0.0.0.0:* LISTEN 8282/stubby
tcp 0 0 127.0.0.1:5453 0.0.0.0:* LISTEN 8282/stubby
udp 0 0 192.168.1.1:5453 0.0.0.0:* 8282/stubby
udp 0 0 127.0.0.1:5453 0.0.0.0:* 8282/stubby
DNSFilter's DNAT rule had to be duplicated for both tcp and udp as that is a syntax requirement when changing the port:
Code:
# iptables-save | grep DNSFILTER
:DNSFILTER - [0:0]
-A PREROUTING -s 192.168.1.0/24 -p udp -m udp --dport 53 -j DNSFILTER
-A PREROUTING -s 192.168.1.0/24 -p tcp -m tcp --dport 53 -j DNSFILTER
-A DNSFILTER -p udp -m udp -m mac --mac-source 94:DE:80:C5:79:52 -j DNAT --to-destination 192.168.1.1:5453
-A DNSFILTER -p tcp -m tcp -m mac --mac-source 94:DE:80:C5:79:52 -j DNAT --to-destination 192.168.1.1:5453
Other than that it worked fine. I checked it was working by looking in the log and using Cloudflare's website.
Considerations:
1. No changes were made to dnsmasq.conf.
2. Obviously for testing I was having to run Stubby manually.
3. This does depend on Stubby having previously been configured through the WAN settings at least once before which might not be the case if the user is only using it for DNSFilter.
4. The stubby.yml file does not normally exist if it hasn't been enabled on the WAN.
5. Stubby is now listening on the LAN interface as well as loopback. I don't see this as problem particularly as dnsmasq does the same.
6. The DNSFilter selection for "DoT" (or whatever it will be called) needs to take into account that it is redirecting to an IP/port instead of just an IP.
7. This assumes that there is only going to be one Stubby instance running on the router which has a shared configuration for the WAN and DNSFilter. Having a choice of different DoT servers similar to how DNSFilter currently works would be too complicated IMHO as it would require running multiple instances of Stubby.
Last edited: