Xray-core icon indicating copy to clipboard operation
Xray-core copied to clipboard

Xray-core v26.10.21 无法转发 127.0.0.1

Open funhunter opened this issue 1 month ago • 20 comments

完整性要求 / Integrity Requirements

  • [x] 我读完了 issue 模板中的所有注释,确保填写符合要求。

  • [x] 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。

  • [x] 我提供了完整的配置文件和日志,而不是出于自己的判断只给出截取的部分。

  • [x] 我搜索了 issues, 没有发现已提出的类似问题。

  • [x] 问题在 Release 最新的版本上可以成功复现

  • [x] I have read all the notes in the issue template and ensured my submission meets the requirements.

  • [x] I guarantee that I have read the documentation and understand the meaning of all the configuration file entries I have written, rather than simply stacking a large number of potentially useful options or defaults.

  • [x] I have provided the complete configuration file and logs, rather than just providing snippets based on my own judgment.

  • [x] I have searched the issues and have not found a similar issue already reported.

  • [x] The issue can be successfully reproduced in the latest Release version.

描述 / Description

最新版[Xray-core v26.10.21] 无法连接 127.0.0.1:10068 ssh 端口 我在服务器端,nc -zv 127.0.0.1 10068 Connection to 127.0.0.1 10068 port [tcp/*] succeeded! 说明127.0.0.1:10068 是正常的

我上一个版本Xray-core v26.3.27,没有这个问题 config.json配置文件没有任何改变

The latest version [Xray-core v26.10.21] is unable to connect to the 127.0.0.1:10068 SSH port. On the server side, running nc -zv 127.0.0.1 10068 yields: Connection to 127.0.0.1 10068 port [tcp/*] succeeded! This indicates that 127.0.0.1:10068 is functioning correctly.

I did not have this problem in the previous version, Xray-core v26.3.27. The config.json configuration file has not been changed.

重现方式 / Steps to Reproduce

我想通过xray vless tcp tls vison 连接服务器的10068 ssh 端口,我将转发地址设置为127.0.0.1 我在本地客户端配置了

I want to connect to the server's 10068 SSH port via xray vless tcp tls vision, and I have set the forwarding address to 127.0.0.1. I configured the local client as follows:

{
  "listen": "127.0.0.1",
  "port": 2503,
  "protocol": "dokodemo-door",
  "settings": {
    "address": "127.0.0.1",
    "port": 10068,
    "network": "tcp"
  }
}

服务器通过freedom 发出,测试时,没有其他任何路由规则

然后通过命令 ssh -p 2503 [email protected], 2503是我本地dokodemo-door 监听地址 实际效果是,ssh 连接失败

修改客户端配置,127.0.0.1改为服务器实际公网ip,例如 "address": "xxx.xx.x.x",

The server sends traffic via freedom, and there are no other routing rules during testing.

Then, I run the command ssh -p 2503 [email protected], where 2503 is the address my local dokodemo-door is listening on. The actual result is that the SSH connection fails.

Modifying the client configuration by changing 127.0.0.1 to the server's actual public IP, e.g., "address": "xxx.xx.x.x":

{
  "listen": "127.0.0.1",
  "port": 2503,
  "protocol": "dokodemo-door",
  "settings": {
    "address": "xxx.xx.x.x",
    "port": 22,
    "network": "tcp"
  }
}

然后,还是这条命令, ssh -p 2503 [email protected] 连接成功

我上一个版本Xray-core v26.3.27,没有这个问题

Then, using the same command, ssh -p 2503 [email protected], the connection succeeds.

I did not have this problem in the previous version, Xray-core v26.3.27.

客户端配置 / Client Configuration

原客户端配置

Original client configuration

{
  "listen": "127.0.0.1",
  "port": 2503,
  "protocol": "dokodemo-door",
  "settings": {
    "address": "127.0.0.1",
    "port": 10068,
    "network": "tcp"
  }
}

修改后客户端配置

Modified client configuration

{
  "listen": "127.0.0.1",
  "port": 2503,
  "protocol": "dokodemo-door",
  "settings": {
    "address": "x.x.x.x",
    "port": 10068,
    "network": "tcp"
  }
}

服务端配置 / Server Configuration

    {
      "tag": "direct",
      "protocol": "freedom"
    },

客户端日志 / Client Logs

2026/10/23 14:33:39.242258 [Info] [3883811706] transport/internet/tcp: dialing TCP to tcp:x.x.x.x:xxxx
2026/10/23 14:33:39.242262 [Debug] [3883811706] transport/internet: dialing to tcp:x.x.x.x:xxxx
2026/10/23 14:33:39.276779 [Info] [3883811706] proxy/vless/outbound: tunneling request to tcp:127.0.0.1:10068 via x.x.x.x:xxxx

服务端日志 / Server Logs

2026/10/23 14:00:02.512766 [Warning] core: Xray 26.10.21 started
2026/10/23 14:01:06.327524 [Info] [450590513] proxy/vless/inbound: firstLen = 178
2026/10/23 14:01:06.327610 [Info] [450590513] proxy/vless/inbound: received request for tcp:127.0.0.1:10068
2026/10/23 14:01:06.327615 [Debug] app/stats: create new counter user>>>[email protected]>>>traffic>>>uplink
2026/10/23 14:01:06.327618 [Debug] app/stats: create new counter user>>>[email protected]>>>traffic>>>downlink
2026/10/23 14:01:06.327664 [Info] [450590513] app/dispatcher: default route for tcp:127.0.0.1:10068
2026/10/23 14:01:06.327670 [Info] [450590513] proxy/freedom: blocked target: tcp:127.0.0.1:10068, blackholing connection for 49s
2026/10/23 14:01:06.327729 [Debug] [450590513] proxy: Xtls Unpadding new block, content 41 padding 72 command 0



2026/10/23 14:01:25.298867 [Info] [552868179] proxy/vless/inbound: firstLen = 243
2026/10/23 14:01:25.298956 [Info] [552868179] proxy/vless/inbound: received request for tcp:x.x.x.x.:10068
2026/10/23 14:01:25.298967 [Info] [552868179] app/dispatcher: default route for tcp:x.x.x.x.:10068
2026/10/23 14:01:25.298971 [Info] [552868179] transport/internet/tcp: dialing TCP to tcpx.x.x.x.:10068
2026/10/23 14:01:25.298974 [Debug] [552868179] transport/internet: dialing to tcp:x.x.x.x.:10068
2026/10/23 14:01:25.300731 [Info] [552868179] proxy/freedom: connection opened to tcpx.x.x.x.:10068, local endpoint 192.168.0.81:65330, remote endpoint x.x.x.x.:10068

funhunter avatar Oct 23 '26 06:10 funhunter

问ai,会告诉你: 问题原因 在 Xray-core 的更新中,出于安全防护机制(防止将代理服务端作为跳板攻击本机私有服务或形成回环环路),freedom 出站协议对回环地址(Loopback,如 127.0.0.1)以及私有局域网目标做了严格的默认拦截与黑洞(blackhole)策略。

winds365 avatar Oct 23 '26 07:10 winds365

https://github.com/XTLS/Xray-core/pull/5947

hann-wang avatar Oct 23 '26 07:10 hann-wang

感谢回答 提出问题的主要原因是,我上一个版本Xray-core v26.3.27,没有这个问题,今天更新,才出现问题。 上面的回复,我看了,需要再freedom中增加一个字段,表示放行 但是,我根据https://github.com/XTLS/Xray-core/pull/5947里的说明,修改freedom为 { "protocol": "freedom", "blockIP": [], "tag": "direct" }, 还是没有效果 我不知道如何增加这个 "blockIP": [], https://xtls.github.io/config/outbounds/freedom.html 这里根本就没有相关的说明

funhunter avatar Oct 23 '26 08:10 funhunter

4. 感谢回答 提出问题的主要原因是,我上一个版本Xray-core v26.3.27,没有这个问题,今天更新,才出现问题。 上面的回复,我看了,需要再freedom中增加一个字段,表示放行 但是,我根据https://github.com/XTLS/Xray-core/pull/5947里的说明,修改freedom为 { "protocol": "freedom", "blockIP": [], "tag": "direct" }, 还是没有效果 我不知道如何增加这个 "blockIP": [], https://xtls.github.io/config/outbounds/freedom.html 这里根本就没有相关的说明

finalRules action: "allow" 试试

winds365 avatar Oct 23 '26 08:10 winds365

4. 感谢回答 提出问题的主要原因是,我上一个版本Xray-core v26.3.27,没有这个问题,今天更新,才出现问题。 上面的回复,我看了,需要再freedom中增加一个字段,表示放行 但是,我根据https://github.com/XTLS/Xray-core/pull/5947里的说明,修改freedom为 { "protocol": "freedom", "blockIP": [], "tag": "direct" }, 还是没有效果 我不知道如何增加这个 "blockIP": [], https://xtls.github.io/config/outbounds/freedom.html 这里根本就没有相关的说明

well, it's ips_blocked in the proto:

https://github.com/XTLS/Xray-core/pull/5947/changes#diff-6f5e051c1c74eb5db632a72dea9d900e6a6d6ece5621467554652720f287bd5dR47

hann-wang avatar Oct 23 '26 08:10 hann-wang

然而 ipsBlocked 早已被 finalRules 取代 https://github.com/XTLS/Xray-core/pull/6027 ,以现行文档为准 https://xtls.github.io/config/outbounds/freedom.html#finalruleobject

RPRX avatar Oct 23 '26 09:10 RPRX

finalRules action: "allow" 试试

不建议这样全部放行,除非这个服务器节点只是自用、不会分享给别人

建议按“最小权限”原则,把专用的 UUID 路由到专门的 Direct/Freedom 出站,其 finalRules 只放行必要的 ip、network、port 组合

@Meo597 文档可以按上面说的写

RPRX avatar Oct 23 '26 09:10 RPRX

这样设置了一下,可以了 需要finalRules 具体放行哪些,后续再优化 感谢!!!!

{
  "protocol": "freedom",
  "settings": {
    "finalRules": [
      {
        "action": "allow"
      }
    ]
  },
  "tag": "direct"
},

funhunter avatar Oct 23 '26 09:10 funhunter

@Meo597 我看了下文档也差不多是这么写的,~~只不过没连到一起~~,那先把 fragment、noises 的内容删了吧,那些出入站的标题后括号也删了

RPRX avatar Oct 23 '26 09:10 RPRX

我记得这还是之前你说的要加来着 还是说只删freedom的括号(反正meo都删了)

Fangliding avatar Oct 23 '26 12:10 Fangliding

R 主席的批示是 那些 (遵照办理)

不行再 revert 我是觉得都删了整齐

Meo597 avatar Oct 23 '26 12:10 Meo597

11. 这样设置了一下,可以了 需要finalRules 具体放行哪些,后续再优化 感谢!!!! { "protocol": "freedom", "settings": { "finalRules": [ { "action": "allow" } ] }, "tag": "direct" },

这个是在哪里修改的?

EuraGoods avatar Oct 26 '26 03:10 EuraGoods

17. > 11. 这样设置了一下,可以了 > 需要finalRules > 具体放行哪些,后续再优化 > 感谢!!!! > { "protocol": "freedom", "settings": { "finalRules": [ { "action": "allow" } ] }, "tag": "direct" },

 这个是在哪里修改的?

再服务器端的出口,outbounding 里,原来只有

{
  "protocol": "freedom",
  "tag": "direct"
},

现在改为

{
  "protocol": "freedom",
  "settings": {
    "finalRules": [
      {
        "action": "allow"
      }
    ]
  },
  "tag": "direct"
},

我这样测试成功,实际使用中,可以根据ip或者端口等进行精确放行,具体参数,可以看文档

funhunter avatar Oct 27 '26 06:10 funhunter

@Meo597 确实是 那些,不过删掉后 Mux、XUDP 不太容易被找到,好在下个月会开始整这俩,到时候再弄吧,然后是 Vision Seed、pre 等

~~主要是因为本来想把 Freedom 后面括号内改为 finalRules,但那个 Tunnel 后面括号内是旧称 dokodemo-door,就有点怪,所以先全删了看看~~

RPRX avatar Oct 27 '26 10:10 RPRX

@RPRX 到时候Vision Seed会固定写死4个数值吗

Raymond520888 avatar Oct 27 '26 10:10 Raymond520888

不过删掉后 Mux、XUDP 不太容易被找到,好在下个月会开始整这俩,到时候再弄吧,然后是 Vision Seed、pre 等

现在内置本地搜索好用,问题不大

Meo597 avatar Oct 27 '26 13:10 Meo597

建议将 2026/11/03 15:40:49.609578 [Info] [763628597] proxy/freedom: blocked target: tcp:10.0.0.1:5666, blackholing connection for 30s 这种日志加入到WARN级别,这两天更新了一下docker排查了半天开DEBUG才发现是更新了安全策略。。。

codexss avatar Nov 03 '26 07:11 codexss

当时的权衡是担心刷屏所以给了 INFO

Meo597 avatar Nov 03 '26 10:11 Meo597

26. 当时的权衡是担心刷屏所以给了 INFO

如果真有刷屏的话也建议WARN,因为真要有这种刷屏请求多半是恶意请求,如果是自用的话自己就ALLOW放行了,或者至少给个阻断的日志,WARN级别看不到真的挺头疼的,眼看着是放行到了direct…

codexss avatar Nov 03 '26 10:11 codexss

有道理

Meo597 avatar Nov 03 '26 12:11 Meo597