Config Deep Dive · · Approx. 19 min read

How to Configure DoH in Clash Meta: fake-ip Alignment Steps on Windows and macOS

If you already run Clash Meta with fake-ip, adding DNS over HTTPS sounds like a one-line edit—and then your split rules start feeling random again. The problem is rarely the https:// prefix in YAML; it is two resolvers racing for the same hostname. This guide shows how to keep mihomo as the only authority: configure DoH inside the dns: block, attach Windows and macOS to the core listener without inviting browser secure DNS, and verify that domain rows still match what you see in logs. For the broader fake-ip versus redir-host trade-off, read the DNS mode comparison; for Chromium-specific confusion around system proxy, use the Chrome and Edge DoH companion.

1. Why DoH Belongs Inside Clash, Not in Five Places at Once

Advanced users enable DNS over HTTPS because they want integrity between their device and a resolver they trust. That goal still holds once you adopt a transparent proxy core. The adjustment is architectural: the encrypted hop should sit between mihomo and the public resolver, while applications on the LAN should talk to Clash Meta first. When Windows, macOS, or a Chromium profile also negotiates its own DoH session to Cloudflare or Google, the browser learns real A and AAAA answers directly. The tunnel then observes IP-first connections, which is the classic reason DOMAIN-SUFFIX rows appear idle even though the page renders. You did not break YAML; you duplicated the control plane.

Desktop trends make this more common, not less. Windows 11 exposes per-adapter encrypted DNS toggles; Edge advertises secure DNS as a safety feature; macOS hands a polished resolver UI that happily coexists with a third-party client unless you reconcile priorities. Add corporate VPNs, Docker Desktop, WSL2, or mobile hotspot tethering and you can easily stack three resolver stacks in one session. The fix is boring governance: pick one authoritative path for the workloads you care about, document it in your profile notes, and re-run the same verification probes after every OS upgrade.

From an editorial stance, treat DoH in Clash as a transport detail for upstream nameserver entries, not a substitute for rule hygiene. You still need ordered rules:, consistent provider updates, and realistic expectations about GeoIP. What changes is telemetry: resolver lines in verbose logs should name your configured upstream group rather than an unexpected external endpoint your GUI never declared.

2. How fake-ip and Upstream DoH Interact

Under enhanced-mode: fake-ip, the core answers many client queries immediately with addresses drawn from fake-ip-range while it completes resolution through the upstream list. That design preserves hostname fidelity for the rule engine: the first policy evaluation often still “sees” the original name, which keeps boutique service bundles manageable. The upstream list may use plain UDP, DNS-over-TLS, or DNS over HTTPS—the fake-ip machinery does not care about wire format as long as the pipeline returns answers the core can map back to queries.

Confusion appears when people equate “using DoH” with “turning on secure DNS everywhere.” In the good layout, Chromium stops being a resolver entirely; it becomes another consumer of whichever IP your OS DHCP or manual DNS points to—typically 127.0.0.1 bound to Clash. The browser’s job is TLS and HTTP, not competing DNS state. When that separation collapses, you observe sticky symptoms: cached HTTP/3 sockets established under an old mapping, QUIC retry loops, or CDN nodes that disagree with the country you targeted in YAML because two caches resolved different edges for the same brand hostname.

IPv6 amplifies the story. fake-ip defaults and IPv6 toggles vary between GUI exports; if one address family bypasses the listener while the other does not, you can proxy IPv4 and leak IPv6 (or the reverse) without touching subscriptions. Before you blame https:// latency in nameserver, confirm both families either go through the core or are deliberately excluded with a documented reason. Half-fixed dual stack is the silent killer of reproducible benchmarks.

3. YAML: DoH Upstreams, Listeners, and Safe Defaults

Start from a profile exported by your GUI, then adjust deliberately. The fragment below is illustrative: replace hostnames with the resolvers your threat model accepts, align listen with the port your client exposes, and extend fake-ip-filter with anything that must never be synthesized. Comments stay in English so diffs stay readable in Git.

dns:
  enable: true
  listen: 0.0.0.0:1053  # example; match your GUI and firewall plan
  ipv6: false  # flip with care; verify both families as a pair
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  use-hosts: true
  nameserver:
    - https://dns.example/dns-query#ResolverA
    - tls://dot.example#ResolverB
  fallback:
    - https://fallback.example/dns-query
  fallback-filter:
    geoip: true
    geoip-code: CN  # illustrative; align with your region strategy
    ipcidr:
      - 240.0.0.0/4
  fake-ip-filter:
    - +.lan
    - +.local

Practice: When you add the first working DoH line, change nothing else for ten minutes. Reload the core, hit three canary domains (a domestic news site, a SaaS API host, a CDN-heavy app), and read verbose logs. If policy lines jump wildly, revert the last mile OS change—not the upstream URL.

Resolver policy knobs such as nameserver-policy help when specific suffixes must pin to a compliance-friendly path while the default list stays fast globally. Keep those maps close to your rules: documentation: future you should understand why api.vendor.example bypassed the default chain without spelunking git blame. If your subscription ships mega rule-sets, remember imported files can reorder semantics; snapshot and diff after each provider refresh as highlighted in our GEOIP maintenance articles.

For readers mixing DoH and DoT, either is fine upstream; consistency matters more than dogma. Pick two independent operators, monitor catch failures in logs, and avoid hard-coding endpoints that block your residential ISP without a spare. Rotate keys and URLs the same way you rotate nodes: calmly, with a rollback file one directory up.

4. Windows: Adapter DNS, Encrypted DNS, and Chromium

On Windows 10 and Windows 11, open the adapter properties for the interface that actually carries default route traffic while Clash runs. If you use a TUN or Meta tunnel interface created by the client, follow that vendor’s doc for whether DNS should remain automatic or point at 127.0.0.1. Mixed setups exist: some users keep DHCP DNS on Wi-Fi but let the virtual adapter advertise the local listener—either pattern works when only one stack wins per query.

Next, disable OS-level encrypted DNS unless you intentionally route those queries elsewhere. When Windows negotiates DoH to a public provider while Clash also serves DNS, you recreate parallel resolution. The toggle lives under network settings for the active adapter; after changes, run ipconfig /flushdns from an elevated shell as a courtesy, then reopen browsers entirely so idle QUIC sessions do not resurrect old paths.

Chromium policies apply to both Chrome and Edge. Set secure DNS to off during calibration, or to “use your current service provider” semantics equivalent to deferring to the OS. Extensions that ship ad blocking or “privacy” DNS frequently inject their own resolver—disable them temporarily when diagnosing stubborn hostname bypass. If you rely on WSL2, remember Linux guests maintain separate resolv.conf behavior; either feed them the Windows-side Clash address deliberately or accept that CLI tools may resolve differently from Edge until aligned.

Firewall prompts deserve patience. The first time Clash binds a listener, allow private networks only when you understand the LAN threat model. Document which executable owns the rule; duplicate vendor installs love to append stale allow entries that reference an older binary path and silently drop UDP while TCP still works, producing surreal partial failures.

5. macOS: Interface DNS, iCloud, and Safari or Chromium

On macOS, open Network settings, select the service that carries your default route—Wi-Fi or Ethernet—and set DNS servers to 127.0.0.1 when your GUI exposes a local listener on the loopback interface. If the client binds only inside a helper bridge, mirror whatever address the vendor documents; some builds prefer listing the tunnel interface IP instead of loopback. Apply the change, toggle the service off and on once, and clear the DNS cache if you know how: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder remains the ritual many engineers still use before reading logs.

iCloud Private Relay and similar Apple features introduce another encrypted path. For debugging sessions, disable them so hostname queries do not split across Apple infrastructure and your YAML. You can re-enable after validation; the point is to stop debating three moving variables simultaneously. Safari inherits system resolver settings more quietly than Chromium; if Safari works while Chrome fails, suspect extension or secure DNS rather than Clash itself.

Developers running Docker Desktop or local Kubernetes stacks should check whether those products rewrote resolver files inside Linux VMs. The symptom pattern matches Windows WSL2: host browsers obey Clash while curl inside a container cheerfully uses another upstream. Standardize on documenting “who is allowed to resolve without Clash” instead of pretending one global toggle fixes everything.

Laptop sleep cycles matter. After resume, some clients need a full restart to reattach listeners cleanly; partial wake states may leave DNS timing in a half-open posture until you quit and reopen the GUI. If your team shares profiles, bake a short internal runbook bullet for “post-sleep verification” so newcomers do not assume upstream DoH latency doubled overnight.

6. Verification Checklist Before You Touch More Rules

Verification should answer three questions in order: which hostname did the app use, which resolver actually answered it, and which rule matched first. If any answer comes from intuition rather than text, keep working. Start by tailing verbose logs while you open exactly one fresh incognito window per test to avoid connection reuse noise.

Packet captures are optional; log discipline usually suffices. When IP-first flows persist after this checklist, escalate to sniffing cautiously and only with filters tight enough to respect privacy. The sniffer articles in this cluster explain how to read SNI without turning the feature into permanent wallpaper.

Keep a three-domain smoke test in your notes and run it monthly: a domestic property, a blocked or rate-limited API, and a streaming or gaming property if that matters to you. Upstream routing should feel boring when healthy; excitement usually means regression.

7. Troubleshooting: Symptoms Map to Bypass Patterns

When pages load but policies “feel wrong,” inventory bypass before touching proxy-groups. Secure DNS in Chromium is the usual suspect; the second is an extension that resolves independently; the third is IPv6 or hotspot tethering flipping your interface order. Windows update loves to re-enable helpful defaults; macOS upgrades occasionally reset network service ordering. Treat those events as routine maintenance rather than personal offense.

If domestic-direct lists hijack SaaS APIs, examine rule order rather than blaming DoH. Elevate narrow domain rows, document why they deserve precedence, and resist stuffing exceptions at the bottom of merged files where imported providers overshadow them. The combination of fake-ip, thoughtful fake-ip-filter, and ordered rules: usually restores predictability once resolver bypass is gone.

Latency spikes after switching to https:// upstreams sometimes indicate geographic mismatch or HTTP/2 connection reuse issues, not CPU overload. Test another upstream, compare median RTT, and ensure fallback triggers are not flapping because of an overeager filter. Stable resolver policy beats chasing the hero single endpoint that looks fast from a speed-test banner but stalls on real-world TLS handshakes.

Corporate environments may forbid custom DNS entirely. This guide assumes you operate networks you are allowed to configure. When duty-bound to split work and personal traffic, maintain separate profiles rather than layering exceptions into one file until it becomes unmaintainable folklore.

8. Frequently Asked Questions

Should I enable DoH in the browser if Clash Meta already uses DoH?

Usually no. Parallel secure DNS in Chrome, Edge, or the OS sends queries outside the Clash resolver pipeline, which breaks fake-ip alignment and makes domain rules look idle.

Does fake-ip still work when nameserver uses https:// URLs?

Yes. fake-ip governs how local clients are answered; DoH only defines how mihomo reaches upstream resolvers. The critical requirement is that applications query mihomo instead of public DoH endpoints directly.

What if only some sites ignore my rules?

Treat it as bypass: check IPv6, extensions, and cached sockets, then read logs for IP-first flows. Add sniffer guidance only after restoring single-source resolver authority.

9. Closing Thoughts

Combining DNS over HTTPS with fake-ip in Clash Meta is less about collecting features and more about shrinking resolver fan-out until logs tell a single story. Once upstream encryption lives inside dns: and the OS relinquishes duplicate secure DNS, domain-centric rules regain the crisp behavior readers expect from mihomo.

Many one-click VPN clients hide DNS behind opaque switches: you cannot see whether queries hit the tunnel resolver, which fallback fired, or why a GEOIP row preempted a suffix rule. That convenience trades away the audit trail that power users need when something subtle breaks after an OS patch. A maintained Meta-based client paired with explicit YAML rewards readers who treat resolver policy as infrastructure—not a mystery setting—together with clear Windows and macOS hygiene, documentation you can diff, and verbose evidence when policies disagree. → Download Clash for free and experience the difference

Hand-picked deep-dives on the same topic — practical Clash routing guides in the same category.