[GH-ISSUE #6842] [Question]: I am experiencing an issue with Dokodemo-door (Tunnel protocol) in the latest 3x-ui / Xray-core versions. #4552

Open
opened 2026-10-31 20:40:28 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @hossein404 on GitHub (Oct 15, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6842

What are you trying to do?

I have a working reverse WireGuard tunnel between two servers, and I want to forward incoming TCP/UDP traffic through a 3x-ui Tunnel inbound to a private IP address reachable over WireGuard.

The WireGuard connection is established and the private network is reachable. However, the Xray Tunnel inbound accepts incoming TCP connections but does not appear to forward the application traffic to the specified private destination.

This configuration is intended to work as a simple TCP/UDP port forward over an existing WireGuard connection.

Environment

Component| Version / Details
OS| Ubuntu 24.04 LTS
Kernel| 6.8.0-31-generic
3x-ui| 3.10.x
Xray-core| 26.10.10
Inbound protocol| "tunnel" (Dokodemo-door)
Network| TCP / UDP
Destination| Private IP over reverse WireGuard

Network topology

External Client
|
| TCP connection
v
Public Server (3x-ui / Xray)
213.177.178.46:1280
|
| Dokodemo-door / Tunnel inbound
v
Reverse WireGuard Connection
|
v
Private WireGuard IP
10.60.1.2:2334
|
v
Destination Service

The expected behavior is to forward incoming connections on port "1280" to "10.60.1.2:2334".

Actual inbound configuration

This configuration is present in the 3x-ui database and also appears in Xray's generated configuration:

{
"protocol": "tunnel",
"port": 1280,
"settings": {
"rewriteAddress": "10.60.1.2",
"rewritePort": 2334,
"portMap": {},
"allowedNetwork": "tcp,udp",
"followRedirect": false
}
}

The inbound is enabled.

I also have another Tunnel inbound targeting the same private destination:

{
"protocol": "tunnel",
"port": 2334,
"settings": {
"rewriteAddress": "10.60.1.2",
"rewritePort": 2334,
"portMap": {},
"allowedNetwork": "tcp,udp",
"followRedirect": true
}
}

Observed behavior

  • Xray starts successfully.
  • The Tunnel port is listening.
  • External clients can establish TCP connections to the public inbound.
  • The server acknowledges incoming application data.
  • No application response is received by the client.
  • The captured traffic excerpt does not show a corresponding outbound TCP connection to the private WireGuard destination.
  • The WireGuard connection itself is reported as operational.

tcpdump evidence

Capture command:

tcpdump -i any -nn -s 96
'tcp port 1280 or (host 10.60.1.2 and tcp port 2334)'

Relevant output:

216.147.121.19:61618 > 213.177.178.46:1280 [S]
213.177.178.46:1280 > 216.147.121.19:61618 [S.]
216.147.121.19:61618 > 213.177.178.46:1280 [.]
216.147.121.19:61618 > 213.177.178.46:1280 [P.] length 592
213.177.178.46:1280 > 216.147.121.19:61618 [.] ack 593
216.147.121.19:61618 > 213.177.178.46:1280 [F.]
213.177.178.46:1280 > 216.147.121.19:61618 [F.]

The incoming connection and payload are acknowledged, but the client receives no application response.

The excerpt does not establish whether Xray attempted forwarding through a different routing path.

Expected behavior

Xray should forward incoming TCP/UDP connections to the configured private destination "10.60.1.2:2334", provided that the destination is reachable through the server's WireGuard interface and is not explicitly blocked by routing rules.

Steps to reproduce

  1. Install 3x-ui with Xray-core "26.10.10".
  2. Establish a working WireGuard connection with a private peer address, such as "10.60.1.2".
  3. Create a Tunnel inbound using "rewriteAddress", "rewritePort", and "allowedNetwork" as shown above.
  4. Set the destination to "10.60.1.2:2334".
  5. Restart Xray and verify the inbound port is listening.
  6. Connect to the public inbound port and send application data.
  7. Observe that the connection is accepted but traffic is not successfully forwarded.

Questions for maintainers

  1. Is forwarding Tunnel traffic to RFC1918/private IP addresses supported in Xray-core "26.10.10"?
  2. Could the new Tunnel implementation or outbound "finalRules" prevent forwarding to private WireGuard addresses?
  3. Do 3x-ui's default routing rules, such as "geoip:private" blocking, affect Tunnel inbounds targeting private IPs?
  4. Is an explicit routing rule or "freedom" outbound required to forward traffic through a WireGuard interface?
  5. Is this a known compatibility issue related to the migration from legacy "address" / "port" / "network" fields to "rewriteAddress" / "rewritePort" / "allowedNetwork"?

I would appreciate clarification on whether this is a bug or whether an additional routing configuration is required in newer Xray-core versions.

I can provide additional routing configuration, Xray logs, WireGuard route information, and packet captures if needed.

What have you already tried?

No response

3x-ui version

3.10.2

How did you install 3x-ui?

install.sh script

Operating system

No response

Screenshots or config snippets

No response

Before submitting

  • I read the Wiki and searched existing issues.
  • This is a usage question, not a bug report.
  • This question is written in English.
Originally created by @hossein404 on GitHub (Oct 15, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6842 ### What are you trying to do? I have a working reverse WireGuard tunnel between two servers, and I want to forward incoming TCP/UDP traffic through a 3x-ui Tunnel inbound to a private IP address reachable over WireGuard. The WireGuard connection is established and the private network is reachable. However, the Xray Tunnel inbound accepts incoming TCP connections but does not appear to forward the application traffic to the specified private destination. This configuration is intended to work as a simple TCP/UDP port forward over an existing WireGuard connection. Environment Component| Version / Details OS| Ubuntu 24.04 LTS Kernel| 6.8.0-31-generic 3x-ui| 3.10.x Xray-core| 26.10.10 Inbound protocol| "tunnel" (Dokodemo-door) Network| TCP / UDP Destination| Private IP over reverse WireGuard Network topology External Client | | TCP connection v Public Server (3x-ui / Xray) 213.177.178.46:1280 | | Dokodemo-door / Tunnel inbound v Reverse WireGuard Connection | v Private WireGuard IP 10.60.1.2:2334 | v Destination Service The expected behavior is to forward incoming connections on port "1280" to "10.60.1.2:2334". Actual inbound configuration This configuration is present in the 3x-ui database and also appears in Xray's generated configuration: { "protocol": "tunnel", "port": 1280, "settings": { "rewriteAddress": "10.60.1.2", "rewritePort": 2334, "portMap": {}, "allowedNetwork": "tcp,udp", "followRedirect": false } } The inbound is enabled. I also have another Tunnel inbound targeting the same private destination: { "protocol": "tunnel", "port": 2334, "settings": { "rewriteAddress": "10.60.1.2", "rewritePort": 2334, "portMap": {}, "allowedNetwork": "tcp,udp", "followRedirect": true } } Observed behavior - Xray starts successfully. - The Tunnel port is listening. - External clients can establish TCP connections to the public inbound. - The server acknowledges incoming application data. - No application response is received by the client. - The captured traffic excerpt does not show a corresponding outbound TCP connection to the private WireGuard destination. - The WireGuard connection itself is reported as operational. tcpdump evidence Capture command: tcpdump -i any -nn -s 96 \ 'tcp port 1280 or (host 10.60.1.2 and tcp port 2334)' Relevant output: 216.147.121.19:61618 > 213.177.178.46:1280 [S] 213.177.178.46:1280 > 216.147.121.19:61618 [S.] 216.147.121.19:61618 > 213.177.178.46:1280 [.] 216.147.121.19:61618 > 213.177.178.46:1280 [P.] length 592 213.177.178.46:1280 > 216.147.121.19:61618 [.] ack 593 216.147.121.19:61618 > 213.177.178.46:1280 [F.] 213.177.178.46:1280 > 216.147.121.19:61618 [F.] The incoming connection and payload are acknowledged, but the client receives no application response. The excerpt does not establish whether Xray attempted forwarding through a different routing path. Expected behavior Xray should forward incoming TCP/UDP connections to the configured private destination "10.60.1.2:2334", provided that the destination is reachable through the server's WireGuard interface and is not explicitly blocked by routing rules. Steps to reproduce 1. Install 3x-ui with Xray-core "26.10.10". 2. Establish a working WireGuard connection with a private peer address, such as "10.60.1.2". 3. Create a Tunnel inbound using "rewriteAddress", "rewritePort", and "allowedNetwork" as shown above. 4. Set the destination to "10.60.1.2:2334". 5. Restart Xray and verify the inbound port is listening. 6. Connect to the public inbound port and send application data. 7. Observe that the connection is accepted but traffic is not successfully forwarded. Questions for maintainers 1. Is forwarding Tunnel traffic to RFC1918/private IP addresses supported in Xray-core "26.10.10"? 2. Could the new Tunnel implementation or outbound "finalRules" prevent forwarding to private WireGuard addresses? 3. Do 3x-ui's default routing rules, such as "geoip:private" blocking, affect Tunnel inbounds targeting private IPs? 4. Is an explicit routing rule or "freedom" outbound required to forward traffic through a WireGuard interface? 5. Is this a known compatibility issue related to the migration from legacy "address" / "port" / "network" fields to "rewriteAddress" / "rewritePort" / "allowedNetwork"? I would appreciate clarification on whether this is a bug or whether an additional routing configuration is required in newer Xray-core versions. I can provide additional routing configuration, Xray logs, WireGuard route information, and packet captures if needed. ### What have you already tried? _No response_ ### 3x-ui version 3.10.2 ### How did you install 3x-ui? install.sh script ### Operating system _No response_ ### Screenshots or config snippets _No response_ ### Before submitting - [x] I read the [Wiki](https://github.com/MHSanaei/3x-ui/wiki) and searched [existing issues](../issues?q=is%3Aissue). - [x] This is a usage question, not a bug report. - [x] This question is written in English.
Author
Owner

@MHSanaei commented on GitHub (Oct 16, 2026):

@claude analyze

<!-- gh-comment-id:6212796559 --> @MHSanaei commented on GitHub (Oct 16, 2026): @claude analyze
Author
Owner

@github-actions[bot] commented on GitHub (Oct 16, 2026):

This is not a bug. Forwarding a Tunnel inbound to a private (RFC1918) address works. It fails here because 3x-ui's default Xray template blocks every private destination twice: once in routing and again inside the direct freedom outbound. 10.60.1.2 is in 10.0.0.0/8, so Xray accepts the client, matches the destination as geoip:private and sends the connection to the blocked blackhole. That fits your capture: the handshake completes, the payload is ACKed, and no packet ever goes to 10.60.1.2:2334.

Answers to your questions

  1. Are private destinations supported? Yes. Nothing in the Tunnel inbound itself rejects them. The panel's own api inbound is a Tunnel inbound pointed at 127.0.0.1 (internal/web/service/config.json:11-18).
  2. Do freedom finalRules block it? Yes. This is the second block, described below.
  3. Does the geoip:private routing rule apply to Tunnel inbounds? Yes. It has no inboundTag, so it matches traffic from every inbound.
  4. Do you need an explicit rule? Yes. See the fix below.
  5. Is this caused by the move to rewriteAddress/rewritePort/allowedNetwork? No. Your generated config already uses the new field names, and the panel's own template uses them too (config.json:16).

Why the traffic is blocked

Default template, internal/web/service/config.json:

"routing": { "rules": [
  { "inboundTag": ["api"], "outboundTag": "api", "type": "field" },
  { "ip": ["geoip:private"], "outboundTag": "blocked", "type": "field" },   // lines 70-76
  ...

Even when routing sends the traffic to direct, the freedom outbound refuses private targets (config.json:31-40):

"finalRules": [
  { "action": "block", "ip": ["geoip:private"] },
  { "action": "allow" }
]

This is deliberate anti-SSRF hardening. It was added after #6037 in 892c06c8 ("Bug-label issue sweep: 16 fixes (#6083)"), first released in v3.6.0. The same commit also added a one-time migration, hardenFreedomFinalRules / rewriteFreedomFinalRulesPrivateEgress (internal/database/db.go:2696-2768). On upgrade it rewrote existing direct outbounds that had empty, allow-only or the older allow-geoip:private-only finalRules to the block-then-allow pair above. So an older install that once forwarded to private IPs will also stop doing so after upgrading.

Fix (Xray Configs in the panel)

  1. Add a dedicated outbound that is allowed to reach the WireGuard subnet. Doing this leaves the default protection on direct in place for all other traffic:
    {
      "tag": "wg-lan",
      "protocol": "freedom",
      "settings": {
        "finalRules": [
          { "action": "allow", "ip": ["10.60.1.2/32"] },
          { "action": "block" }
        ]
      }
    }
    
    You can widen the allowed range to your WireGuard subnet (for example 10.60.1.0/24) if you need more hosts.
  2. Add a routing rule above the geoip:private → blocked rule. Rules are first-match-wins, as described in docs/content/docs/en/operations/outbounds-routing.mdx:139:
    { "type": "field", "inboundTag": ["<your tunnel inbound tag>"], "outboundTag": "wg-lan" }
    
    Copy the tag exactly as the Inbounds list shows it. The panel generates tags of the form in-<port>-<transport>.
  3. Save and restart Xray. If it still fails, set the access log to a file and connect once. The access log line for the connection shows which outbound it took (-> blocked vs -> wg-lan). After that it is a host routing problem: check ip route get 10.60.1.2 on the panel server.

Note: your second inbound on port 2334 has followRedirect: true. With that flag, Xray uses the original destination recovered from an iptables REDIRECT/TPROXY rule instead of rewriteAddress. It is not involved in the port 1280 path, and you don't need it for a plain port forward.

Verdict: Not a bug (user configuration)
Severity: N/A
Confidence: High for the two blocking rules, Medium that they are what dropped your connection (inferred; your Xray access log and full routing config are not in the report)
Root cause: The default template routes geoip:private to the blocked blackhole (internal/web/service/config.json:70-76), and the direct freedom outbound blocks geoip:private in finalRules (config.json:34-35). Both are intentional anti-SSRF defaults from 892c06c8 (v3.6.0).
Same class: None found
Already fixed: Not applicable
Duplicate of: Related: #6037 (origin of the hardening), #6669 (same default blocking LAN access)
Evidence: config.json:35 { "action": "block", "ip": ["geoip:private"] }; config.json:71-74 "ip": ["geoip:private"], "outboundTag": "blocked"; internal/database/db.go:2754-2757 migration writing the same block rule into existing templates
Not determined: Whether your live template still has these rules unchanged. The access log line for one test connection (-> blocked) would confirm it.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:6212826949 --> @github-actions[bot] commented on GitHub (Oct 16, 2026): This is not a bug. Forwarding a Tunnel inbound to a private (RFC1918) address works. It fails here because 3x-ui's default Xray template blocks every private destination twice: once in routing and again inside the `direct` freedom outbound. `10.60.1.2` is in `10.0.0.0/8`, so Xray accepts the client, matches the destination as `geoip:private` and sends the connection to the `blocked` blackhole. That fits your capture: the handshake completes, the payload is ACKed, and no packet ever goes to `10.60.1.2:2334`. ### Answers to your questions 1. **Are private destinations supported?** Yes. Nothing in the Tunnel inbound itself rejects them. The panel's own `api` inbound is a Tunnel inbound pointed at `127.0.0.1` (`internal/web/service/config.json:11-18`). 2. **Do freedom `finalRules` block it?** Yes. This is the second block, described below. 3. **Does the `geoip:private` routing rule apply to Tunnel inbounds?** Yes. It has no `inboundTag`, so it matches traffic from every inbound. 4. **Do you need an explicit rule?** Yes. See the fix below. 5. **Is this caused by the move to `rewriteAddress`/`rewritePort`/`allowedNetwork`?** No. Your generated config already uses the new field names, and the panel's own template uses them too (`config.json:16`). ### Why the traffic is blocked Default template, `internal/web/service/config.json`: ```json "routing": { "rules": [ { "inboundTag": ["api"], "outboundTag": "api", "type": "field" }, { "ip": ["geoip:private"], "outboundTag": "blocked", "type": "field" }, // lines 70-76 ... ``` Even when routing sends the traffic to `direct`, the freedom outbound refuses private targets (`config.json:31-40`): ```json "finalRules": [ { "action": "block", "ip": ["geoip:private"] }, { "action": "allow" } ] ``` This is deliberate anti-SSRF hardening. It was added after #6037 in `892c06c8` ("Bug-label issue sweep: 16 fixes (#6083)"), first released in v3.6.0. The same commit also added a one-time migration, `hardenFreedomFinalRules` / `rewriteFreedomFinalRulesPrivateEgress` (`internal/database/db.go:2696-2768`). On upgrade it rewrote existing `direct` outbounds that had empty, allow-only or the older allow-`geoip:private`-only `finalRules` to the block-then-allow pair above. So an older install that once forwarded to private IPs will also stop doing so after upgrading. ### Fix (Xray Configs in the panel) 1. **Add a dedicated outbound** that is allowed to reach the WireGuard subnet. Doing this leaves the default protection on `direct` in place for all other traffic: ```json { "tag": "wg-lan", "protocol": "freedom", "settings": { "finalRules": [ { "action": "allow", "ip": ["10.60.1.2/32"] }, { "action": "block" } ] } } ``` You can widen the allowed range to your WireGuard subnet (for example `10.60.1.0/24`) if you need more hosts. 2. **Add a routing rule above the `geoip:private` → `blocked` rule.** Rules are first-match-wins, as described in `docs/content/docs/en/operations/outbounds-routing.mdx:139`: ```json { "type": "field", "inboundTag": ["<your tunnel inbound tag>"], "outboundTag": "wg-lan" } ``` Copy the tag exactly as the Inbounds list shows it. The panel generates tags of the form `in-<port>-<transport>`. 3. Save and restart Xray. If it still fails, set the access log to a file and connect once. The access log line for the connection shows which outbound it took (`-> blocked` vs `-> wg-lan`). After that it is a host routing problem: check `ip route get 10.60.1.2` on the panel server. Note: your second inbound on port 2334 has `followRedirect: true`. With that flag, Xray uses the original destination recovered from an iptables REDIRECT/TPROXY rule instead of `rewriteAddress`. It is not involved in the port 1280 path, and you don't need it for a plain port forward. Verdict: Not a bug (user configuration) Severity: N/A Confidence: High for the two blocking rules, Medium that they are what dropped your connection (inferred; your Xray access log and full routing config are not in the report) Root cause: The default template routes `geoip:private` to the `blocked` blackhole (`internal/web/service/config.json:70-76`), and the `direct` freedom outbound blocks `geoip:private` in `finalRules` (`config.json:34-35`). Both are intentional anti-SSRF defaults from `892c06c8` (v3.6.0). Same class: None found Already fixed: Not applicable Duplicate of: Related: #6037 (origin of the hardening), #6669 (same default blocking LAN access) Evidence: `config.json:35` `{ "action": "block", "ip": ["geoip:private"] }`; `config.json:71-74` `"ip": ["geoip:private"], "outboundTag": "blocked"`; `internal/database/db.go:2754-2757` migration writing the same block rule into existing templates Not determined: Whether your live template still has these rules unchanged. The access log line for one test connection (`-> blocked`) would confirm it. _This reply was generated automatically; a maintainer may follow up._ <!-- claude-issue:analyst -->
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#4552
No description provided.