Clash, Mihomo & Sing-box FakeIP (198.18.x.x) and DNS Leak Guide
Clash / Mihomo / Sing-box FakeIP (198.18.x.x) 与 DNS 泄漏排查
Seeing 198.18.0.1 in a WebRTC test is NOT a public IP leak — 198.18.0.0/15 is the RFC 2544 range used by Clash, Mihomo, and Sing-box FakeIP/TUN adapters. A real DNS leak happens when foreign domain lookups go to your local ISP DNS instead of exiting through your proxy.
测漏时看到 198.18.0.1 不是公网泄漏——198.18.0.0/15 是 Clash、Mihomo、Sing-box 开启 FakeIP 或 TUN 模式时创建的本地虚拟网段。真正的 DNS 泄漏,是访问海外网站时域名解析请求绕过代理发给了本地宽带运营商的 DNS。
You ran an online leak test while running Clash or Sing-box in TUN mode. Either you panicked after seeing 198.18.0.1 in red, or your DNS resolver list still showed your home telecom ISP.
开着 Clash / Mihomo 或 Sing-box 的 TUN 模式测漏,结果要么看到红字 198.18.0.1 吓一跳,要么上游 DNS 列表里依然混进了本地电信/联通/移动的解析服务器。
Diagnostic Breakdown (Scene → Risk → Fix)
核心排查对照表(场景 → 风险 → 解法)
| What You See | Is It a Real Leak? | What It Means |
|---|---|---|
| WebRTC shows 198.18.0.1 | No (Virtual TUN) | Local FakeIP/TUN virtual interface; does not reveal your real WAN IP. |
| WebRTC shows home ISP IP | Yes (Critical Leak) | Browser bypassed the proxy over UDP STUN and exposed your real IP. |
| DNS probe shows local ISP resolver | Yes (DNS Leak) | Fallback/nameserver rules sent unknown domains to your local ISP. |
| DNS probe shows exit-country resolver | Clean | Upstream resolution exited cleanly through your proxy node. |
| 测到的现象 | 算真泄漏吗? | 实际含义 |
|---|---|---|
| WebRTC 显示 198.18.0.1 | 不算(虚拟网卡) | 代理客户端 TUN / FakeIP 模式的本地虚拟地址,不暴露真实公网 IP。 |
| WebRTC 显示宽带真实公网 IP | 算(严重泄漏) | 浏览器的 UDP STUN 绕开了代理,把你家真实公网 IP 交给了网页。 |
| DNS 探针抓到本地运营商 IP | 算(DNS 泄漏) | 分流配置把未命中规则的域名交给了本地 DNS 解析,运营商可见访问记录。 |
| DNS 探针全为出口国解析器 | 正常安全 | 域名解析与流量出口在同一个路径上,没有绕回本地。 |
Actionable Commands & Setup
分系统实操命令与设置
dns:
enable: true
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
nameserver:
- https://dns.cloudflare.com/dns-query
- https://dns.google/dns-query
1. Why FakeIP Prevents Most Browser DNS Leaks
一、为什么 FakeIP 通常比 redir-host 更防漏
In redir-host mode, the local proxy resolves a domain to a real IP before matching rules. If fallback DNS is sloppy, lookups leak to your local ISP. In FakeIP mode, the client returns a placeholder 198.18.x.x address and forwards the raw hostname straight to the remote server.
在 redir-host 模式下,客户端经常要先在本地把域名解析成 IP 再匹配分流规则,配置一松就会把海外域名送给宽带 DNS。而 FakeIP 直接给浏览器返回一个 198.18.x.x 占位地址,把原始域名整包发给远端节点去解析,本地运营商根本看不到。
2. Two Leaks That Still Happen Under FakeIP
二、开了 FakeIP 依然可能翻车的两个地方
First, Chrome/Edge built-in Secure DNS (DoH) can bypass system proxies if pointing to a domestic DoH server. Second, overly broad fallback-filter rules can send brand-new random subdomains to local nameservers.
第一是浏览器自带的安全 DNS(DoH)绕过了系统代理;第二是 fallback 规则把未缓存的新随机子域错误分流给了本地 nameserver。用 /leak-test/ 的 6 路随机子域探针,5 秒就能测出是不是真走远端解析。
Frequently Asked Questions
常见疑问
Should I disable FakeIP because 198.18.0.1 shows up?
No. Keep FakeIP enabled for clean DNS routing, and lock WebRTC non-proxied UDP inside Chrome/Edge so websites cannot read local interfaces at all.
看到 198.18.0.1 要把 FakeIP 关掉吗?
不用关。FakeIP 本身能很好地防 DNS 泄漏,只需要在浏览器里锁死 WebRTC UDP,让网页读不到本地虚拟网卡和真实 IP 即可。