Skip to content

FakeDNS: Change default FakeIPv6Pool to 2001:2::/48 - #6815

Merged
RPRX merged 1 commit into
XTLS:mainfrom
vincentng295:fakedns-ipv6-pool
Sep 26, 2026
Merged

RPRX merged 1 commit into
XTLS:mainfrom
vincentng295:fakedns-ipv6-pool

Conversation

@vincentng295

Copy link
Copy Markdown
Contributor

Change default FakeDNS IPv6 pool to avoid Chrome's Private Network Access (PNA) prompts

This PR addresses the issue raised in #5458

Background

Chromium-based browsers (Chrome v141+) have fully enforced Private Network Access (PNA) protections. When a public website attempts to connect to an IP address classified as "Private," the browser now triggers a "Local network access" permission prompt to the user.

The Problem

Xray-core's default FakeDNS IPv6 pool is fc00::/18, a subrange of fc00::/7 (Unique Local Address / ULA space). Because ULA addresses are explicitly classified as Private under the PNA spec, virtually every proxied connection using FakeDNS now triggers this permission popup, the browser interprets ordinary proxied traffic as a public site probing the user's local network.

This significantly degrades the browsing experience for anyone using Xray with FakeDNS enabled on Chrome-based browsers, and will only get worse as PNA enforcement expands to cover more request types.

Proposal

Change the default FakeDNS IPv6 range from fc00::/18 to 2001:2::/48, reserved by RFC 5180 for benchmarking/testing purposes.

Why this range:

  1. Bypasses PNA entirely: 2001:2::/48 falls under Global Unicast address space, not ULA, so it is never classified as "Private" by the PNA algorithm. Connections to fake IPs in this range no longer trigger the local-network permission prompt.
  2. No routing conflicts: per RFC 5180, this block is reserved for benchmarking and is not meant to appear in production routing tables, so there is effectively zero risk of collision with real internet destinations.
  3. Minimal behavior change: this is purely a default-value change to the FakeDNS pool; users who explicitly configure their own FakeIPv6Pool are unaffected. Existing deployments that rely on the old default can pin it explicitly in their config if needed.
  4. Future-proofing: as PNA enforcement broadens (Chrome's stated direction), keeping FakeDNS output inside address space Chrome trusts as "public" avoids this class of breakage recurring for other protected resources.

Discussion

See #5458 for the original report and community discussion of this issue, including the alternative 2001:db8::/32 (RFC 3849, Documentation range) suggestion. 2001:2::/48 was chosen deliberately over the Documentation range for a semantic reason: 2001:db8::/32 is explicitly reserved for documentation and examples (RFC 3849), meaning it is intended to never appear in real traffic in some tools, linters, and security scanners specifically flag or special-case addresses in this block as "placeholder/example" values, which could cause confusing behavior if they ever leak into logs, DNS records, or diagnostics.
2001:2::/48, by contrast, is the IPv6 Benchmarking range (RFC 5180) which conceptually analogous to 198.18.0.0/15 in IPv4, which Xray/other proxy tools already use for exactly this kind of fake-IP purpose. Like 198.18.0.0/15, this range is:

  • Not classified as private as it's Global Unicast, so it doesn't trigger PNA prompts.
  • Not globally routed as it's reserved strictly for isolated benchmark/test networks, so there's no real-world routing conflict.
  • Not "documentation-only" as it doesn't carry the same "this is a fake placeholder" semantic baggage as 2001:db8::/32, and it's rarely (if ever) used by consumer routers or LAN equipment, minimizing any chance of accidental overlap with a user's actual local network.

In short, 2001:2::/48 gives the same practical benefits as 2001:db8::/32 (avoids PNA, non-routable) while mirroring the existing IPv4 convention (198.18.0.0/15) already familiar to this codebase, without inheriting the "documentation address" connotation that could confuse tooling downstream.

References

Change default FakeDNS IPv6 pool to avoid Chrome's Private Network Access (PNA) prompts
@Fangliding

Copy link
Copy Markdown
Member

确实该改 就是不知道会不会有什么防火墙问题啥的

@KobeArthurScofield

Copy link
Copy Markdown
Collaborator

我这这样配置用了很久了目前还没遇到防火墙问题
fakeip 从入站进去嗅探了几乎都会被翻译掉问题不大

@vincentng295

vincentng295 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author

确实该改 就是不知道会不会有什么防火墙问题啥的

It's basically the IPv6 version of 198.18.0.0/15, which Xray/other tools already use as FakeIP for IPv4 without firewall issues in practice, since FakeIP packets never actually hit the real network (they're intercepted and resolved locally before routing), so there's nothing for a real firewall to block or flag.

image

@RPRX

RPRX commented Sep 25, 2026

Copy link
Copy Markdown
Member

如果 Xray 关了,应用会不会把流量直接发到公网而造成某种泄露?尤其是 TUN、没路由器的时候

@kokoromagic

kokoromagic commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

To be honest, 198.18.0.0/15 which is also Global-Unicast-equivalent but routing is not permitted, has the same risks of 2001:2::/48. When xray is closed, the traffic is really sent to interface.
In fact, Xray-core already ships 198.18.0.0/15 as default without reported leak issues, in practice: 2001:2::/48 isn't announced/routable by any real ISP, so even if a packet leaves the NIC, it dies at the first hop that does proper BGP filtering, and any serious TUN setup should already have a kill-switch/fail-closed rule that blocks all traffic when the tunnel drops, independent of which FakeIP range is used - relying on ULA's non-routability as an implicit leak-prevention mechanism isn't something we should be depending on anyway.
If we want extra safety, we could recommend/document that TUN-mode users configure a fail-closed rule (drop all non-loopback traffic when the tun device is absent), which closes this gap regardless of FakeIP range chosen.
Also worth pointing out: with the current fc00::/18 default, users end up having to click "Allow" on the Local Network Access prompt just to make basic browsing work - because Chrome thinks every proxied site is probing their LAN. This trains users to reflexively grant that permission.
That's arguably a worse security posture than the leak edge case above: once users are conditioned to always click "Allow," a genuinely malicious site requesting real Local Network Access to actually probe the user's real LAN devices (printers, routers, IoT, NAS, etc.) is far more likely to get permission too. We'd be turning a meaningful browser security prompt into background noise - which defeats the purpose PNA was introduced for in the first place.
So the trade-off is: a theoretical, narrow leak-on-failure edge case (mitigated by fail-closed TUN rules) vs. a practical, everyday erosion of a real security boundary that affects every user, every session. The latter seems like the bigger risk to ship by default.

@RPRX

RPRX commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

这个 PR 会被合并,但我只是脑洞到上述问题,没人报告过泄露不等于没泄露过,尤其是纯 Xray 的话 FakeDNS 主要是用在外部路由器 TPROXY 上,而加上 TUN 之后本机直接拨号/蜂窝网络也能用,ISP 想的话只要声称能通这些网段,应用的第一个握手包就会被路由过去,如果有路由器的话可能能覆盖/有层防护,但内网网段不同的话也废了,直接拨号大概没防护,至于蜂窝网络手机有没有防护就不清楚了,得测测,有没有 ISP 真的这么干也得关注下,我怎么依稀记得有些 ISP 会拿来搞一些网页什么的

@RPRX RPRX changed the title FakeDNS: Change default FakeDNS IPv6 pool to 2001:2::/48 (suggestion) FakeDNS: Change default FakeIPv6Pool to 2001:2::/48 Sep 26, 2026
@RPRX
RPRX merged commit 3519dfe into XTLS:main Sep 26, 2026
40 checks passed
@KobeArthurScofield

Copy link
Copy Markdown
Collaborator

现在 FakeDNS 返回的查询结果 TTL 是 1,除了刚断开的一小段时间以及应用不遵守 TTL 的情况其余的时间倒是还好

@RPRX

RPRX commented Sep 26, 2026

Copy link
Copy Markdown
Member

问题是比如蜂窝网络,TTL 1 也没用,握手包还是发外面了,我忘了说一点,这个问题无关后续是否 drop,只要发外面就输了

@RPRX

RPRX commented Sep 26, 2026

Copy link
Copy Markdown
Member

看岔了,我以为你说 IP TTL,DNS TTL 1 的话确实能缓解

@kokoromagic

Copy link
Copy Markdown
Contributor

ISPs can also fall into the 198.18.0.0/15 range if they wish

@RPRX

RPRX commented Sep 26, 2026

Copy link
Copy Markdown
Member

于是我又想到另一个问题,如果没给网卡配置境外 DoH 的话那么应用的下个 DNS 查询也是直接泄露,但应该没人给网卡配置境外 DoH 吧不然不设 source 的话国内的应用会变得奇奇怪怪,反之亦然,另外这还和 TUN 要解决的 DNS 泄露问题 互相冲突

TUN 的 DNS 泄露问题该由 core 解决,但没开 core/GUI 时的问题只能由 $288 解决了,我的设想是没开 $288 时就不给连网络

@RPRX

RPRX commented Sep 26, 2026

Copy link
Copy Markdown
Member

不过其实在 Windows 上也能由 core 来做这件事,最基础的就是改全部网卡的 DNS 且不改回去,加上其它一些手段确保断网,而在 iOS、安卓上的 GUI 可能没有啥合规手段可用不然上不了架/被认为是病毒,大概要让用户允许它开机自启且不杀它后台?

@vincentng295
vincentng295 deleted the fakedns-ipv6-pool branch October 31, 2026 08:50
patterniha added a commit to patterniha/PattN that referenced this pull request Nov 11, 2026
PattN dropped the FakeIP range setting (6ee9a88, 97db1d7) because it
could only name an IPv4 range, and left the pools to Xray-core's
defaults. Upstream's 2dust#10464 adds an optional IPv6 pool, so PattN takes
upstream's settings back: the IPv4 range, the IPv6 FakeIP switch and
its range in both DNS settings windows, and Xray's "fakedns" block (one
pool, or both) and sing-box's fakeip ranges made from them.

The defaults keep what PattN gave before:
- IPv6 FakeIP is on, also for settings saved without the switch:
  ConfigHandler sets it on, and both cores and the window read an unset
  switch as on, so a WebAPI client that leaves it out gets the same;
- the IPv6 range defaults to 2001:2::/48, Xray-core's own pool since
  XTLS/Xray-core#6815; fc00::/18 stays in the list.
sing-box still leaves the IPv6 range out of a TUN without IPv6, where
fake IPv6 addresses would be unreachable.

The WebAPI offers both range lists among the DNS editor options, and
refuses an IPv6 range no core could use while the pool is on, as the
settings window does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants