01The finding
The network hands out two resolvers: the primary, local, and a remote secondary for redundancy. Yet the logs showed that an Android TV box only ever queried the secondary.
02The mechanism
Android offers “Private DNS” in automatic mode, on by default since Android 9. It tries a DNS-over-TLS connection (TCP 853) to the resolvers received through DHCP. Those that answer are used over encrypted DNS, and they take priority over plain DNS.
Here only the secondary resolver listened on port 853. The device therefore adopted it for all its queries: the primary became a fallback that was never used.
03Opportunistic, so unverified
This mode matches the “opportunistic” profile of RFC 8310: with no name to check, Android does not verify the resolver’s certificate. It protects against passive eavesdropping, not against a malicious server. Strict mode, with a hostname entered, checks the certificate and refuses to fall back to clear text.
04Two possible fixes
Either enable DNS-over-TLS on the primary too, so it gets chosen as well. Or stop the local network from reaching the secondary’s port 853, so the attempt fails and the device stays on plain DNS with the primary.
The second option was chosen, with a reject rather than a silent drop: a reject answers immediately and the device gives up the attempt at once, whereas an ignored packet would make it wait. Plain DNS (port 53) to the secondary remains allowed, to keep redundancy.
DNS-over-TLS only uses TCP. The UDP line targets DNS-over-QUIC (RFC 9250), which shares port 853: it only closes that door too.
# The LAN can't reach the secondary's DoT/DoQ: immediate reject
table inet filter {
chain forward {
type filter hook forward priority 0;
iifname "lan0" ip daddr 198.51.100.53 tcp dport 853 reject with tcp reset
iifname "lan0" ip daddr 198.51.100.53 udp dport 853 reject
}
}05Verify
Android re-runs its probe at every network change. After a reconnection, queries go back to the primary and the secondary only receives fallback traffic. A DoT test from the LAN must fail immediately:
kdig +tls @198.51.100.53 example.com # expected: connection refused, no waitKey takeaways
- Android’s automatic Private DNS tries port 853 on every resolver it receives.
- One DoT-capable resolver is enough to capture all the device’s traffic.
- Automatic mode = opportunistic: encrypted, but the certificate is not checked.
- Reject rather than drop: the failure is immediate, no timeout.
- Blocking DoT doesn’t prevent plain DNS fallback.
Example rule in nftables; the same logic applies to any firewall. Documentation-reserved addresses.
Official sources
- Android: DNS-over-TLS support in Android Pandroid-developers.googleblog.com/2018/04/dns-over-tls-support-in-android-p.html
- RFC 7858: DNS over TLSwww.rfc-editor.org/rfc/rfc7858
- RFC 8310: strict and opportunistic profileswww.rfc-editor.org/rfc/rfc8310
- nftables: rejecting trafficwiki.nftables.org/wiki-nftables/index.php/Rejecting_traffic