6
Ensure only defined DNS servers are used?
(programming.dev)
All discussions about the open source, FreeBSD-based firewall called OPNsense.
Each network is different. I did this for my network which has multiple subnets and internal DNS servers sitting on the "server" subnet. The "server" subnet is excluded, since devices in there are more tightly controlled (and it would create a routing loop).
Granted, it may not be the best way, but here is how I did it:
Since NAT port forward rules are processed before interface/network rules, any device using port 53 for DNS (regardless of the IP address they have set) will automatically (and transparently) get redirected to my PiHole servers. The drops are in place so devices that try to use other common DNS methods are blocked. Generally, those devices will then default to the DHCP DNS servers.
I have been running this config for a few years and have found a few downsides:
Hope this helps! And remember to be careful when messing with DNS and clear those caches when testing.