flclash.st
English
简体中文繁體中文EnglishРусскийفارسی

HomeDigestAndroid

Android Private DNS and routing

Android's Private DNS encrypts lookups with DNS over TLS; set to a specific server, it may bypass FlClash's DNS so domain routing fails or some apps resolve strangely. The three modes, how they relate to FlClash, and what the Block DoT preset does.

A phone lock screen: Private DNS hides in the system settings, and many people do not know it is on
A phone lock screen: Private DNS hides in the system settings, and many people do not know it is on 蓝芷怡, CC BY-SA 4.0

Since Android 9 there is a "Private DNS" setting that encrypts name lookups with DNS over TLS (DoT, port 853). On its own it is a good thing, keeping your carrier from tampering with lookups. But used with FlClash, it sometimes makes routing rules fail for no obvious reason.

Not every phone runs into the clash between Private DNS and FlClash. Manufacturers and Android versions handle VPNs and Private DNS differently: some systems send DNS through the VPN automatically when it is on, others insist on Private DNS. So someone else saying "no problem" does not mean your phone has none; the reliable way is to look on the Requests page yourself. Changing settings once you see a problem is safer than turning everything off from the start. The Requests page shows domains, exits and the rules hit at a glance, which beats guessing, and makes it easy to describe the situation accurately when asking for help.

Three modes

ModeBehaviourWith FlClash
OffOrdinary DNS from the networkThe easiest; DNS goes to FlClash
AutomaticUses DoT when available, ordinary DNS otherwiseUsually fine
Private DNS provider hostnameUses only the DoT server you enteredMay bypass FlClash and break routing

Where it lives varies by manufacturer, usually Settings → Network & internet → Private DNS, or under "More connection settings".

A handwritten address book: DNS is the book that turns names into addresses
A handwritten address book: DNS is the book that turns names into addresses Daderot, CC0

Why it breaks

FlClash routes by domain only if it knows which domain you are visiting. Normally the system's DNS lookups pass through FlClash, which records which address belongs to which name.

With Private DNS set to a specific hostname, the system asks that DNS server directly over an encrypted connection. FlClash sees only an encrypted connection to port 853 and cannot see which domain was asked about. Domain-based rules may then fail to match, and some traffic leaves by the wrong exit.

A phone's system settings screen: Private DNS hides deep in menus like this
A phone's system settings screen: Private DNS hides deep in menus like this Kārlis Dambrāns, CC BY 2.0

How to set it

  1. Open the system settingsFind "Private DNS"
  2. Choose "Off" or "Automatic"Not "Private DNS provider hostname"
  3. Restart the proxy in FlClashSo the new DNS setting applies
  4. Check on the Requests pageDomains should show normally
Private DNS while using FlClash

If you must keep a specific hostname for some reason, enable the "Block DoT" preset in FlClash. With port 853 blocked, the system falls back to ordinary DNS and hands it to FlClash.

Spotting the problem on the Requests page

Open FlClash's Requests page; normally every connection shows a domain, such as www.example.com. If many connections show only IP addresses, or you see lots of connections to port 853, name lookups are not passing through FlClash.

What the Requests page showsLikely cause
Most connections show domainsNormal
Many connections show only IPsDNS is not going through FlClash
Many connections to port 853Private DNS is using DoT
The DNS query list is emptySystem DNS bypasses FlClash completely

FlClash's own DNS

FlClash's configuration can set upstream DNS servers, and many providers' configurations already use encrypted upstreams such as DoH addresses. In other words, turning off the phone's Private DNS does not expose your lookups in plain text to the carrier; FlClash forwards them encrypted.

When FlClash is off

If you run FlClash only part of the time and want Private DNS the rest of the time, set Private DNS to "Automatic". The system uses it when it can, and it rarely clashes when FlClash is on. If you need to switch back and forth, an automation tool can also set Private DNS to off when FlClash starts.

Apps excluded by access control

If access control keeps some apps (banking, say) out of the VPN, their lookups never go through FlClash anyway, and Private DNS applies to them as usual. Only apps inside the VPN are affected. So when troubleshooting, first check whether the problem app is excluded: an excluded app with lookup trouble most likely has a Private DNS server problem unrelated to FlClash; only apps inside the VPN need the adjustments in this article.

Is turning off Private DNS less safe?

With FlClash on, it handles DNS according to its configuration, which usually already uses encrypted upstream DNS.

Does the browser's "Secure DNS" matter too?

Secure DNS (DoH) in Chrome and other browsers uses port 443 rather than DoT's, but it can likewise hide domains from FlClash. Turn off the browser's Secure DNS while using FlClash.

Routing is still wrong after changing it?

See which rule the connection hit on the Requests page; the rule itself may be the problem.

What goes in the Private DNS box?

The hostname of a DoT server, such as an address given by a public DNS provider, not an IP.

Read on

Read alongside

This page covers: Android Private DNS, FlClash Private DNS, turn off Private DNS