Skip to content

[不连接] TUN 入站,sniff+routeOnly+AsIs,直连 IPv6 流量无法连接 #6281

Closed

Description

@simplerick-simplefun

完整性要求

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

描述

版本:Xray 26.7.28 (Xray, Penetrates Everything.) 5ca6f4b (go1.26.5 windows/amd64)

TUN入站,并配置 sniffing+routeOnly,出站 freedom+domainStrategy: AsIs
Xray 程序启动后,前几秒直连 IPv6 可以正常连接。过了几秒后,直连 IPv6 流量无法连接。

测试命令:
curl -v -I https://www.baidu.com --resolve 'www.baidu.com:443:[2408:871a:2100:186c:0:ff:b07e:3fbc]' --max-time 3

附上的 log 里面有两次测试连接,第一次 [16:59:55] 是前几秒能够连接的,第二次 [17:00:10] 是后面开始不能连接的。
可以看到第二次连接缺少了最后的2026/08/23 16:59:55.393646 [Info] [3703447404] proxy/freedom: connection opened to tcp:[xxxx]:443, local endpoint [yyyy]:5464, remote endpoint [xxxx]:443部分

重现方式

见描述和配置

客户端配置

Details

{
  "log": {
    "access": "",
    "error": "",
    "dnsLog": true,
    "loglevel": "debug"
  },
  "fakedns": [
    {
      "ipPool": "198.18.0.0/15",
      "poolSize": 65535
    },
    {
      "ipPool": "fc00::/108",
      "poolSize": 65535
    }
  ],
  "dns": {
    "servers": [
      {
        "domains": ["geosite:apple-cn"],
        "address": "1.1.1.1",
        "skipFallback": true
      },
      {
        "address": "https+local://1.12.12.12/dns-query",
        "expectIPs": ["geoip:cn"],
        "skipFallback": false
      },
      {
        "address": "https+local://223.5.5.5/dns-query",
        "expectIPs": ["geoip:cn"],
        "skipFallback": false
      },
      "fakedns"
    ],
    "queryStrategy": "UseSystem",
    "enableParallelQuery": false,
    "tag": "xray-module_dns"
  },
  "routing": {
    "domainStrategy": "IPOnDemand",
    "rules": [
      {
        "ruleTag": "rule-ip-direct",
        "ip": [
          "geoip:cn"
        ],
        "outboundTag": "out-direct"
      },
      {
        "ruleTag": "rule-default-proxy",
        "network": "tcp,udp",
        "outboundTag": "out-direct"
      }
    ]
  },
  "inbounds": [
    {
      "tag": "in-tun",
      "protocol": "tun",
      "settings": {
        "name": "tun0",
        "mtu": 1400,
        "gateway": ["10.0.0.1/16", "fdfe::1/64"],
        "userLevel": 0,
        "autoSystemRoutingTable": ["0.0.0.0/0", "::/0"],
        "autoOutboundsInterface": "auto"
      },
      "sniffing": {
        "enabled": true,
        "routeOnly": true,
        "destOverride": [
          "http",
          "tls",
          "quic",
          "fakedns"
        ]
      }
    },
    {
      "tag": "in-socks-19081",
      "protocol": "socks",
      "listen": "127.0.0.1",
      "port": 19098,
      "settings": {
        "auth": "noauth",
        "udp": true,
        "ip": "127.0.0.1"
      },
      "sniffing": {
        "enabled": true,
        "routeOnly": true,
        "destOverride": [
          "http",
          "tls",
          "quic",
          "fakedns"
        ]
      }
    }
  ],
  "outbounds": [
    {
      "tag": "out-direct",
      "protocol": "freedom",
      "settings": {
        "domainStrategy": "AsIs"
      }
    },
    {
      "tag": "out-dns",
      "protocol": "dns",
      "settings": {
        "rewriteNetwork": "udp",
        "rewriteAddress": "1.1.1.1",
        "rewritePort": 53,
        "userLevel": 0,
        "rules": [
          {
            "action": "hijack",
            "qtype": 1
          },
          {
            "action": "hijack",
            "qtype": 28
          },
          {
            "action": "direct",
            "domain": ["regexp:.*"]
          }
        ]
      }
    }
  ]
}

服务端配置

NONE

客户端日志

curl 测试命令日志:

PS C:\Users\homepc> curl -v -I https://www.baidu.com --resolve 'www.baidu.com:443:[2408:871a:2100:186c:0:ff:b07e:3fbc]' --max-time 3
* Added www.baidu.com:443:[2408:871a:2100:186c:0:ff:b07e:3fbc] to DNS cache
* Hostname www.baidu.com was found in DNS cache
* Host www.baidu.com:443 was resolved.
* IPv6: 2408:871a:2100:186c:0:ff:b07e:3fbc
* IPv4: (none)
*   Trying [2408:871a:2100:186c:0:ff:b07e:3fbc]:443...
* schannel: disabled automatic use of client certificate
* ALPN: curl offers http/1.1
* ALPN: server accepted http/1.1
* Established connection to www.baidu.com (2408:871a:2100:186c:0:ff:b07e:3fbc port 443) from fdfe::1 port 5463
* using HTTP/1.x
> HEAD / HTTP/1.1
> Host: www.baidu.com
> User-Agent: curl/8.21.0
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
< Content-Length: 0
Content-Length: 0
< Content-Type: text/html
Content-Type: text/html
< Pragma: no-cache
Pragma: no-cache
< Server: bfe
Server: bfe
< Set-Cookie: BAIDUID=5F04252A208D437E83D42654FEFD4142:FG=1; Path=/; Domain=baidu.com; Max-Age=31536000
Set-Cookie: BAIDUID=5F04252A208D437E83D42654FEFD4142:FG=1; Path=/; Domain=baidu.com; Max-Age=31536000
< Set-Cookie: BAIDUID_BFESS=5F04252A208D437E83D42654FEFD4142:FG=1; Path=/; Domain=baidu.com; Max-Age=31536000; Secure; SameSite=None
Set-Cookie: BAIDUID_BFESS=5F04252A208D437E83D42654FEFD4142:FG=1; Path=/; Domain=baidu.com; Max-Age=31536000; Secure; SameSite=None
< Date: Sun, 23 Aug 2026 08:59:53 GMT
Date: Sun, 23 Aug 2026 08:59:53 GMT
<

* Connection #0 to host www.baidu.com:443 left intact
PS C:\Users\homepc> curl -v -I https://www.baidu.com --resolve 'www.baidu.com:443:[2408:871a:2100:186c:0:ff:b07e:3fbc]' --max-time 3
* Added www.baidu.com:443:[2408:871a:2100:186c:0:ff:b07e:3fbc] to DNS cache
* Hostname www.baidu.com was found in DNS cache
* Host www.baidu.com:443 was resolved.
* IPv6: 2408:871a:2100:186c:0:ff:b07e:3fbc
* IPv4: (none)
*   Trying [2408:871a:2100:186c:0:ff:b07e:3fbc]:443...
* schannel: disabled automatic use of client certificate
* ALPN: curl offers http/1.1
* Connection timed out after 3012 milliseconds
* closing connection #0
curl: (28) Connection timed out after 3012 milliseconds

Xray 日志:
太长,见链接:https://pastebin.com/B7RT8sDs

服务端日志

NONE

Activity

  1. changed the title [-][不连接] TUN入站,sniff+routeOnly+AsIs,直连 IPv6 流量无法连接[/-] [+][不连接] TUN 入站,sniff+routeOnly+AsIs,直连 IPv6 流量无法连接[/+] on Jun 6, 2026
  2. Meo597 commented on Jun 6, 2026

    @Meo597
    Collaborator

    你本地 v6 正常的吗?
    route print 一下看看

  3. simplerick-simplefun commented on Jun 6, 2026

    @simplerick-simplefun
    Author

    你本地 v6 正常的吗?
    route print 一下看看

    我ipv6的出站都可以正常连接,本地ipv6没问题的

  4. Fangliding commented on Jun 6, 2026

    @Fangliding
    Member

    transport/internet: dialing to xxx 但是没有 proxy/freedom: connection opened to 只可能发生在 freedom 进行 dial 本身从未成功 (如果dialer没被替换成奇奇怪怪的东西一般是未收到 SYN ACK) 不是那个IP拒绝了(直接drop) 就是俩 auto 没能正确处理核心发出的 ipv6 路由
    建议先确认这个IP的连通性 开个抓包跟踪一下或者不用两个auto自己配缩小范围

  5. simplerick-simplefun commented on Jun 13, 2026

    @simplerick-simplefun
    Author

    看了下应该不是Xray的问题,大概是误报。

  6. simplerick-simplefun commented on Aug 23, 2026

    @simplerick-simplefun
    Author

    transport/internet: dialing to xxx 但是没有 proxy/freedom: connection opened to 只可能发生在 freedom 进行 dial 本身从未成功 (如果dialer没被替换成奇奇怪怪的东西一般是未收到 SYN ACK) 不是那个IP拒绝了(直接drop) 就是俩 auto 没能正确处理核心发出的 ipv6 路由 建议先确认这个IP的连通性 开个抓包跟踪一下或者不用两个auto自己配缩小范围

    重新测试了一下,还是有问题。更新了问题说明,附上了完整的配置及log。

  7. simplerick-simplefun commented on Sep 17, 2026

    @simplerick-simplefun
    Author

    无反馈,关闭issue,后续重开。

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