Skip to content

Routing module Bug: 路由功能无法分流ipv4 or ipv6 #5977

Closed

Description

@cupidads

完整性要求

  • 我读完了 issue 模板中的所有注释,确保填写符合要求。
  • 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • 我提供了完整的配置文件和日志,而不是出于自己的判断只给出截取的部分。
  • 我搜索了 issues, 没有发现已提出的类似问题。
  • 问题在 Release 最新的版本上可以成功复现

描述

测试版本v26.4.17疑似路由功能有问题,无法匹配ipv4或ipv6出站,主版本v26.3.27相同的配置没有问题。

重现方式

路由匹配ip:
ip:["0.0.0.0/0"]
outboundTag: out-v4
ip:["::/0"]
outboundTag: out-v6

出站按顺序:

  1. out-v6
  2. out-v4

打开google等同时有v6v4的网站肯定没问题
问题出现在只有v4(X)或只有v6(ipv6.google.com)的网站
按上面的配置只能访问带有v6地址的网站,带v4的网站无法访问

这时把出站顺序改成:

  1. out-v4
  2. out-v6

或路由最后增加一条:
outboundTag: out-v4 or outboundTag: out-v6
"强制所有流量走"
反过来带v4的网站能正常访问,只带v6的网站无法访问

似乎是路由没匹配上ip直接走默认的第一个出站。

要么绑定0.0.0.0全交给网卡判断算了。

客户端配置

目前在服务端发现问题,没再更新部署到客户端测试

服务端配置

{
"vsersion": null,
"log": {
"loglevel": "none",
"dnsLog": true,
"maskAddress": ""
},
"dns": {
"hosts": {
"dns.google": [
"2001:4860:4860::8888",
"8.8.8.8"
],
"dns11.quad9.net": [
"2620:fe::11",
"9.9.9.11"
]
},
"servers": [
{
"tag": "fakedns",
"address": "fakedns",
"domains": [
"geosite:sogou",
"geosite:adblock",
"geosite:adblockplus",
"geosite:adguard",
"geosite:category-ads",
"geosite:category-ads-all",
"geosite:category-ads-ir"
],
"expectedIPs": null,
"unexpectedIPs": null,
"skipFallback": true,
"queryStrategy": "UseIP",
"timeoutMs": 5000,
"disableCache": false,
"finalQuery": false,
"serveStale": true,
"serveExpiredTTL": 86400
},
{
"tag": "google",
"address": "https://dns.google/dns-query",
"port": 443,
"expectedIPs": null,
"unexpectedIPs": null,
"skipFallback": true,
"queryStrategy": "UseIP",
"timeoutMs": 5000,
"disableCache": false,
"finalQuery": false,
"serveStale": true,
"serveExpiredTTL": 900
}
],
"queryStrategy": "UseIP",
"disableCache": false,
"disableFallback": false,
"disableFallbackIfMatch": false,
"useSystemHosts": false,
"serveStale": true,
"serveExpiredTTL": 900,
"enableParallelQuery": true,
"tag": "dns"
},
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"inboundTag": [
"fakedns"
],
"outboundTag": "drop",
"ruleTag": "reject-rule"
},
{
"inboundTag": [
"dns"
],
"outboundTag": "dns-direct",
"ruleTag": "all-out"
},
{
"inboundTag": [
"vless-reality-in2"
],
"domain": [
"geosite:google",
"geosite:google-registry",
"geosite:google-registry-tld",
"geosite:google-scholar",
"geosite:google-trust-services",
"geosite:googlefcm",
"geosite:google-play",
"geosite:google-gemini",
"geosite:google-deepmind",
"geosite:greatfire",
"geosite:bilibili-game",
"geosite:bilibili",
"geosite:bilibili2",
"geosite:github",
"geosite:x",
"geosite:telegram",
"geosite:twitter",
"geosite:steam",
"geosite:steamunlocked",
"geosite:youtube"
],
"ip": [
"::/0"
],
"outboundTag": "direct-out-ipv6",
"ruleTag": "all-out"
},
{
"inboundTag": [
"vless-reality-in2"
],
"domain": [
"geosite:google",
"geosite:google-registry",
"geosite:google-registry-tld",
"geosite:google-scholar",
"geosite:google-trust-services",
"geosite:googlefcm",
"geosite:google-play",
"geosite:google-gemini",
"geosite:google-deepmind",
"geosite:greatfire",
"geosite:bilibili-game",
"geosite:bilibili",
"geosite:bilibili2",
"geosite:github",
"geosite:x",
"geosite:telegram",
"geosite:twitter",
"geosite:steam",
"geosite:steamunlocked",
"geosite:youtube"
],
"ip": [
"0.0.0.0/0"
],
"outboundTag": "direct-out-ipv4",
"ruleTag": "all-out"
},
{
"domain": [
"geosite:sogou",
"geosite:adblock",
"geosite:adblockplus",
"geosite:adguard",
"geosite:category-ads",
"geosite:category-ads-all",
"geosite:category-ads-ir"
],
"inboundTag": [
"vless-reality-in2"
],
"outboundTag": "drop",
"ruleTag": "reject-rule"
},
{
"inboundTag": [
"vless-reality-in2"
],
"ip": [
"::/0"
],
"outboundTag": "direct-out-ipv6",
"ruleTag": "all-out"
},
{
"inboundTag": [
"vless-reality-in2"
],
"ip": [
"0.0.0.0/0"
],
"outboundTag": "direct-out-ipv4",
"ruleTag": "all-out"
}
],
"balancers": null
},
"policy": null,
"inbounds": [...],
"outbounds": [
{
"sendThrough": "123::123::",
"protocol": "freedom",
"settings": {
"domainStrategy": "ForceIPv6",
"redirect": null,
"userLevel": 0,
"proxyProtocol": 0
},
"tag": "direct-out-ipv6",
"streamSettings": {
"network": "raw",
"security": "none",
"rawSettings": null,
"sockopt": {
"tproxy": "off",
"domainStrategy": "ForceIPv6",
"happyEyeballs": null,
"dialerProxy": null,
"acceptProxyProtocol": false,
"tcpCongestion": "bbr",
"interface": "eth0",
"v6only": true
}
},
"mux": null,
"targetStrategy": "ForceIPv6"
},
{
"sendThrough": "3333.3333.3333.3333",
"protocol": "freedom",
"settings": {
"testpre": 5,
"domainStrategy": "ForceIPv4",
"redirect": null,
"userLevel": 0,
"proxyProtocol": 0
},
"tag": "direct-out-ipv4",
"streamSettings": {
"network": "raw",
"security": "none",
"rawSettings": null,
"sockopt": {
"tproxy": "off",
"domainStrategy": "ForceIPv4",
"dialerProxy": null,
"acceptProxyProtocol": false,
"tcpCongestion": "bbr",
"interface": "eth1",
"v6only": false
}
},
"mux": null,
"targetStrategy": "ForceIPv4"
},
{
"protocol": "blackhole",
"settings": {
"response": {
"type": "none"
}
},
"tag": "drop"
},
......
],
"fakedns": [...],
"api": null,
"transport": null,
"stats": null,
"reverse": null,
"metrics": null,
"observatory": null,
"burstObservatory": null
}

客户端日志

服务端日志

Activity

  1. changed the title [-]路由功能无法分流ipv4 or ipv6[/-] [+]Routing module Bug: 路由功能无法分流ipv4 or ipv6[/+] on Apr 19, 2026
  2. Meo597 commented on Apr 19, 2026

    @Meo597
    Collaborator
  3. linked a pull request that will close this issueIPMatcher: Fix full CIDR issue #5971on Apr 19, 2026
  4. Geekvcn commented on Apr 20, 2026

    @Geekvcn

    MD排查了好久,发现脚本自动升级了,手动回退版本后正常

  5. Geekvcn commented on Apr 20, 2026

    @Geekvcn

    我怀疑了运营商,怀疑了我的配置文件,怀疑了软件冲突,就是没怀疑xray

  6. Meo597 commented on Apr 20, 2026

    @Meo597
    Collaborator

    侧面反映没什么其它 BUG 了,赢

  7. Meo597 commented on Apr 20, 2026

    @Meo597
    Collaborator

    不过自动升级脚本建议还是仅 latest

  8. Geekvcn commented on Apr 20, 2026

    @Geekvcn

    主要我的翻墙服务器没问题,所以没有第一时间定位到xray上,
    回家服务器就两条路由,然后出问题了,
    "routing": {
    "rules": [
    {
    "type": "field",
    "ip": ["10.10.10.0/24"],
    "outboundTag": "home"
    },
    {
    "type": "field",
    "ip": ["0.0.0.0/0", "::/0"],
    "outboundTag": "blocked"
    }
    ],
    "domainStrategy": "IPOnDemand"
    },
    各种排查,第一时以为运营商又在瞎整,最后才排查到xray上,把路由器上的自动升级脚本给改了

  9. RPRX commented on Apr 20, 2026

    @RPRX
    Member

    pre-release 是专门放出来测 bug 的,也敢自动升级吗

    但该说不说大白鼠还是越多越好

  10. added a commit that references this issue on Apr 25, 2026
  11. jh0072110 commented on Apr 26, 2026

    @jh0072110

    用最新的4.25编译后,我这样写的规则反而无法用了:
    "routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
    {
    "type": "field",
    "outboundTag": "IP6_out",
    "domain": [
    "geosite:youtube"
    ]
    },
    {
    "type": "field",
    "outboundTag": "IP4_out",
    "network": "tcp,udp"
    }
    ]
    }
    照理来说这个规则应该是除了YouTube剩余的都走IPv4(我没理解错的话),但该走IPv4的Netflix就死活打不开了(换成3.27就没问题),是现在写法改了吗?还是bug……

  12. RPRX commented on Apr 26, 2026

    @RPRX
    Member

    @jh0072110 测一下 v26.4.17,开 issue,放完整配置

  13. added a commit that references this issue on Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions