Forcing all DNS through the firewall
A blocklist that only works for the polite devices is half a blocklist. Three moves that catch the rest.
My firewall has had a DNS blocklist for months. Ads, trackers and known malware domains get an empty answer instead of an address. It felt done. Then I asked a simple question: how many of my devices actually use it? The honest answer was "the ones that feel like it".
The devices that go around you
Every device on the home network is told, through DHCP, to use the firewall as its resolver. Most do. But some don't care what DHCP says:
- Hard-coded resolvers. TVs, streaming sticks and plenty of apps ask a public resolver directly. The query still leaves through the VPN, so my internet provider doesn't see it, but it ends up at Google or Cloudflare instead of at my resolver, and the blocklist never gets a say.
- DNS over TLS. Android's "Private DNS" and some routers speak encrypted DNS on its own port. Same result, and invisible as DNS.
- DNS over HTTPS. Browsers can send DNS inside ordinary HTTPS. To the firewall it looks like any other web traffic.
A blocklist that only works for the polite devices is half a blocklist.
Three moves
1. Redirect plain DNS. A NAT rule on the home network catches every packet to port 53 that is not addressed to the firewall and quietly sends it to the firewall's own resolver. The device thinks it is talking to 8.8.8.8. It is talking to me.
2. Block DNS over TLS. One rule: nothing from the home network leaves on port 853. Devices with "automatic" private DNS notice and fall back to normal DNS, which is now redirected.
3. Starve DNS over HTTPS. You can't block a port that every website also uses, so this happens in DNS itself. A blocklist of known DoH servers means the browser never gets an address for them. Firefox also checks a special "canary" domain: if the network says it doesn't exist, Firefox turns DoH off by itself. The trap here is that a blocklist normally answers 0.0.0.0, and that is an answer. Firefox only backs off on a proper "no such domain" (NXDOMAIN), so the canary got its own entry.
Proof, not hope
The nice thing about this change is how easy it is to test. Ask a public resolver for a name that should be blocked:
# asking Google's resolver directly, from a laptop on the home network $ dig +short @8.8.8.8 dns.google 0.0.0.0 ← Google would never say that: my resolver answered $ dig +short @8.8.8.8 example.com 172.66.147.243 ← normal names still work $ dig @8.8.8.8 use-application-dns.net | grep status status: NXDOMAIN ← Firefox's canary: DoH off $ nc -zv -w3 1.1.1.1 853 nc: connect to 1.1.1.1 port 853 (tcp) timed out
dig and nc (I ran them from Windows with the PowerShell equivalents; same results). Every query ends up at the firewall, whatever the device asks for.A better list, and a lesson in allowlists
I also swapped the blocklist. The old one was Steven Black's merged hosts file, mostly ads and malware. The new one is Hagezi's DNS blocklists: curated lists in tiers with far better coverage of tracking and telemetry from phones, TVs and operating systems, updated several times a day. I picked the balanced tier, Pro, plus Threat Intelligence Feeds (malware, phishing and scam domains) and DoH/VPN/TOR/Proxy Bypass, the list of DoH and VPN services that makes step 3 work.
Within an hour, that last list taught me something. It blocks VPN providers, which is the point, and that included the website and status check of the VPN service I pay for. My own "is the VPN on?" check went red. An allowlist entry for the provider's own names, not its DNS servers, fixed it. Since then the rule is: every new list is followed by a look at what it blocked for my services, and anything a critical service depends on goes on the allowlist up front, before a list update can surprise me.
Seeing it
The firewall's resolver keeps statistics, so I wrote a small exporter (plain Python, no dependencies) that reads them with a read-only API key and hands them to Prometheus. A Grafana dashboard turns them into big coloured numbers, much like Pi-hole's: queries, blocked, share blocked, list size, queries over time by answer type, top clients, top domains, top blocked.
The dashboard's first surprise had nothing to do with ads. One machine made 97 % of all DNS queries, about two million a day, from an automated job that checks a few hundred external sources around the clock. Harmless, but it drowned everything else, so the dashboard now shows the share blocked both with and without it. Without it, the rest of the house gets roughly one query in a hundred blocked, and the number is still rising as the new list settles in.

What it cost
- Two firewall rules and one changed blocklist, all through the API with a backup before and after.
- One allowlist mistake, found in an hour.
- Apple's Private Relay switches itself off on the home network, because it is a way around the resolver too. Behind a VPN that is fine; away from home it works as usual.
Now every device on the network gets the same protection, whether it asked for it or not.