Skip to content

Xray-core v26.10.21 无法转发 127.0.0.1 #7240

Closed as not planned
Closed as not planned

Description

@funhunter

完整性要求 / Integrity Requirements

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

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

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

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

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

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

  • 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.

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

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

  • 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

Activity

  1. winds365 commented on Oct 23, 2026

    @winds365

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

  2. hann-wang commented on Oct 23, 2026

    @hann-wang
  3. funhunter commented on Oct 23, 2026

    @funhunter
    Author
  4. winds365 commented on Oct 23, 2026

    @winds365
  5. hann-wang commented on Oct 23, 2026

    @hann-wang
  6. RPRX commented on Oct 23, 2026

    @RPRX
    Member
  7. RPRX commented on Oct 23, 2026

    @RPRX
    Member

    finalRules action: "allow" 试试

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

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

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

  8. pinned this issue on Oct 23, 2026
  9. funhunter commented on Oct 23, 2026

    @funhunter
    Author

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

    {
      "protocol": "freedom",
      "settings": {
        "finalRules": [
          {
            "action": "allow"
          }
        ]
      },
      "tag": "direct"
    },
    
  10. RPRX commented on Oct 23, 2026

    @RPRX
    Member

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

  11. Fangliding commented on Oct 23, 2026

    @Fangliding
    Member

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

  12. Meo597 commented on Oct 23, 2026

    @Meo597
    Collaborator

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

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

  13. 2 remaining items

  14. RPRX commented on Oct 27, 2026

    @RPRX
    Member

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

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

  15. Raymond520888 commented on Oct 27, 2026

    @Raymond520888

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

  16. Meo597 commented on Oct 27, 2026

    @Meo597
    Collaborator

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

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

  17. codexss commented on Nov 3, 2026

    @codexss

    建议将
    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才发现是更新了安全策略。。。

  18. Meo597 commented on Nov 3, 2026

    @Meo597
    Collaborator

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

  19. codexss commented on Nov 3, 2026

    @codexss

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

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

  20. Meo597 commented on Nov 3, 2026

    @Meo597
    Collaborator

    有道理

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