DNS Leak Test: Compare Your Public IP and DNS Resolvers
Routing web traffic through a proxy doesn’t mean DNS queries follow the same path. A DNS leak test generates unique test domains, then lists the recursive resolvers that queried the test’s authoritative servers. If you expect a specific DoH service (DNS over HTTPS) but see resolvers operated by your internet or mobile carrier, check whether queries are bypassing your intended configuration.
- Record your baseline before connecting. On the same Wi-Fi network and in the same browser, note your public IP and the resolver IP addresses and organization names shown by the Extended test on
dnsleaktest.com. The test site receives your browser visits and test queries. Skip this step if you don’t want to establish a direct-connection baseline. - Run the test again after connecting. Start the connection in Clash Meta for Android, confirm that Android shows the VPN icon, and check that the browser you’re testing isn’t excluded from the VPN. Run a fresh test in the same browser and compare the public IP and resolvers with your current routing policy. Don’t treat the previous results page as a new test.
- Change one setting at a time. Keep the Wi-Fi network, browser, and proxy group fixed. After changing a setting, reload the configuration and run a fresh test. Once Wi-Fi testing is complete, repeat the process on mobile data. Use newly generated test domains so cached DNS results aren’t mistaken for an unapplied configuration.
Android Troubleshooting: VPN, Private DNS, and Browser Settings
Before changing your YAML, check which resolver is receiving queries. dns.enable: true only enables mihomo’s DNS module; it doesn’t automatically make every app use it. On Android, the client creates a virtual interface through VpnService. The actual DNS path depends on which apps are covered by the VPN, how the client handles DNS, and whether an app performs its own DNS resolution.
- Check which apps are covered by the VPN. Review the client’s app access controls and make sure the browser you’re testing is included. The Android VPN icon only confirms that a VPN session is active. If the test page still shows a direct public IP, check which rule handled the web connection rather than assuming DNS is the cause.
- Note your current Private DNS setting. On a Pixel, go to Settings → Network & internet → Private DNS. If Private DNS provider hostname is selected, Android tries to connect to the specified resolver over TLS, typically on TCP port 853. You can temporarily select Off for comparison. To check whether your original setting works with the client, restore it and run another test. On other Android devices, search Settings for “Private DNS.”
- Check Chrome’s “Use secure DNS” setting separately. Go to Settings → Privacy and security → Use secure DNS. With a custom provider selected, Chrome can send DNS queries over HTTPS, typically on port 443. This HTTPS connection may use the VPN, while Chrome still sends queries to its own chosen resolver. For example, if your configuration uses Cloudflare but Chrome is set to Google, seeing Google in the results doesn’t necessarily mean DNS bypassed the VPN.
Desktop mihomo TUN configurations commonly use any:53 and tcp://any:53 to match regular DNS traffic. They don’t redirect encrypted DNS over TCP port 853 or DoH inside HTTPS to the core for resolution. Android clients may not expose the same TUN settings. Don’t assume desktop YAML is a one-size-fits-all fix for a phone.
How fake-ip and nameserver-policy Work Together
enhanced-mode: fake-ip maps domain names to synthetic IP addresses. An app might receive 198.18.0.2 instead of the website’s actual address. Once mihomo intercepts the connection, the core uses the mapping to recover the domain and choose an outbound route based on the rules. Seeing a synthetic address means the response went through the relevant DNS handling; it doesn’t mean the real DNS lookup has happened or that the query was sent through a proxy.
nameserver-policy selects the resolver for specific domains, taking precedence over the usual nameserver and fallback selection. The example below uses one default upstream and a policy to illustrate domain matching. Merge these fields into the same active dns: mapping. Don’t replace your entire subscription or add a second dns: key at the root level.
dns:
enable: true
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
default-nameserver:
- "https://1.1.1.1/dns-query"
nameserver:
- "https://1.1.1.1/dns-query"
proxy-server-nameserver:
- "https://1.1.1.1/dns-query"
nameserver-policy:
"+.example.org":
- "https://8.8.8.8/dns-query"
default-nameserverresolves the hostnames of DNS upstreams. This example specifies DoH endpoints by IP, so their domain names don’t need to be resolved first. Your current network must still be able to reach those endpoints.proxy-server-nameserverresolves the domain names of proxy nodes. If a node address is an IP, it doesn’t need a DNS lookup. For nodes configured with hostnames, make sure the resolver used to resolve them is reachable before the proxy connects. Otherwise, you can create a loop where the proxy must connect before its hostname can be resolved.+.example.orgmatchesexample.organd its subdomains, but not unrelated domains generated by a DNS test page. To verify a policy, visit a domain that actually falls within its scope and check the client’s DNS logs if available. A standard test page can’t validate this policy for you.
If local network discovery or internal domains stop working after switching modes, add the affected names to fake-ip-filter so they receive real DNS responses. This exception only changes the response type: use nameserver-policy to route internal domains to a reachable resolver that knows them. Public DoH services won’t return your local network addresses.
How fallback Chooses Responses and Routes Queries
fallback isn’t just a standby server contacted only when the primary resolver goes down. When enabled, mihomo can query the default and fallback upstreams concurrently, then choose a result based on fallback-filter. If regular queries must go to a single specified upstream, first check for and remove any inherited fallback setting from your subscription or overrides, then test again. A filter doesn’t enforce this restriction.
If you need a fallback upstream to handle unusual responses, add the following two settings under dns: in the example above. This example disables GeoIP-based filtering and only demonstrates handling specific response IP ranges. Domains covered by an existing nameserver-policy still use their designated upstream.
fallback:
- "https://8.8.8.8/dns-query"
fallback-filter:
geoip: false
ipcidr:
- "0.0.0.0/32"
- "240.0.0.0/4"
These ranges match IP addresses in the default upstream’s responses, not DNS server IPs. For example, if the default upstream returns 0.0.0.0, the match condition tells the core to use the fallback response instead. Other addresses returned by the default upstream could also be problematic; these two ranges won’t catch every unusual result. The fallback service may have already received the query, even when the default response is ultimately used.
DoH Doesn’t Mean the Upstream Uses a Proxy
DoH encrypts traffic between the client making the request and the resolver. If mihomo’s connection to a DoH upstream must also use a specific proxy, check whether your core supports and has enabled dns.respect-rules, and make sure your rules route the DoH endpoint to the intended proxy group. For endpoints specified by IP, check the destination IP rules and their order; rules that only match website domains won’t be enough. Before enabling this, configure a reachable proxy-server-nameserver to resolve node hostnames. Otherwise, both the nodes and domains may become unreachable.
After Saving: Verify the Configuration Works
- Reload the active configuration. After saving, confirm that the modified configuration is the one currently running. Subscription updates can overwrite manual edits. If your client supports local overrides, use them to maintain DNS settings, then check the values in the merged active configuration.
- Check website access and the resolver list. Visit a working website, then run a new test. If only the expected DNS service appears and the website is routed by the correct rule, this browser, network, and configuration have passed this test. If additional resolvers still appear, check the browser’s own DoH settings first, then look for multiple leftover
nameserverorfallbackentries. - Separate node connection failures from domain resolution failures. If the node stops connecting after your changes, revert the DNS changes first and check whether the node hostname resolves through its bootstrap resolver. If the node connects but only some domains fail, check whether
nameserver-policymatches those domains and whether its upstream is reachable. - Restore your everyday settings and test again. Turn Private DNS or the browser’s Use secure DNS setting back on if you temporarily disabled it during troubleshooting. Then test on both Wi-Fi and mobile data. If the resolver list changes only after restoring one setting, you’ve isolated the cause without repeatedly switching
fake-ip.
The goal is to confirm that traffic follows the intended routes: website connections use the rules you expect, test queries are resolved by the expected service, and upstream connections that should use a proxy are routed through it. Verify each separately; a change in one doesn’t confirm the other two.