mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5980] [Bug]: Tunnel inbound does not accept nftables TPROXY TCP traffic #4146
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#4146
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Slikpro on GitHub (Jul 15, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5980
Describe the bug
Environment
3x-ui: 3.5.0
Xray-core: 26.7.11
OS: Debian 13 ARM
Device: NanoPi NEO3 Plus
Firewall: nftables
Traffic type: IPv4 TCP
Description:
A Tunnel inbound created by 3x-ui listens on the configured port, but does not accept TCP traffic redirected through Linux TPROXY.
The generated Xray configuration contains:
{
"listen": "0.0.0.0",
"port": 22222,
"protocol": "tunnel",
"settings": {
"allowedNetwork": "tcp",
"followRedirect": true,
"portMap": {}
},
"streamSettings": {
"security": "none",
"sockopt": {
"tproxy": "tproxy"
}
},
"tag": "in-22222-tcp"
}
The inbound is routed to a working SOCKS outbound.
nftables and policy routing
Traffic arriving from the LAN is redirected with:
meta l4proto tcp
meta mark set 0x1
tproxy ip to 127.0.0.1:22222
counter
accept
Policy routing:
100: from all fwmark 0x1/0x1 lookup 100
local default dev lo scope host
The TPROXY counter increases during client connection attempts, and:
ip route get 1.1.1.1 mark 0x1
returns a local route through table 100.
Xray is listening:
tcp LISTEN *:22222 users:(("xray-linux-arm6",pid=...,fd=...))
How to reproduce the problem
Install 3x-ui 3.5.0 with Xray-core 26.7.11 on Debian 13.
Create a working SOCKS outbound named Local-Proxy.
Create a Mixed inbound and confirm that it can use Local-Proxy.
Create a Tunnel inbound on port 22222.
Set:
Allowed network: TCP
Follow redirect: enabled
Sockopt TProxy: tproxy
Add an Xray routing rule from the Tunnel inbound tag to Local-Proxy.
Configure nftables to redirect TCP traffic arriving from the LAN interface to 127.0.0.1:22222 using TPROXY and firewall mark 1.
Add policy routing for mark 1 with a local default route through lo.
Configure another LAN device to use the 3x-ui host as its default gateway.
Generate an external TCP connection from that device without configuring an explicit proxy.
Observe the nftables counters and Xray debug log.
Expected behavior
When the nftables TPROXY rule redirects the client TCP connection to port 22222, Xray should:
Accept the connection on the Tunnel inbound.
Recover the original destination through followRedirect.
Create an inbound session with tag in-22222-tcp.
Dispatch the connection to the Local-Proxy outbound.
Connect to the upstream SOCKS proxy.
Record the inbound request in the debug or access log.
An expected log sequence would contain a Tunnel/dokodemo inbound request for the original external destination, followed by a dispatcher route to Local-Proxy.
Actual behavior
The client TCP SYN reaches eth0.
The nftables TPROXY rule matches it.
The TPROXY packet counter increases.
Firewall mark 1 is applied.
The policy-routing rule and table 100 are present.
Xray is listening on port 22222.
No user Tunnel/dokodemo inbound request appears in the Xray debug log.
No session with inbound tag in-22222-tcp is created.
No connection is dispatched to Local-Proxy.
The client TCP connection times out.
3x-ui reports zero traffic for this inbound.
Relevant logs
Screenshots
No response
3x-ui version
3.5.0
Xray-core version
26.7.11
How did you install 3x-ui?
install.sh script
Operating system
Debian 13
Which parts of the panel are affected?
Xray config generation
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
None
Before submitting
@github-actions[bot] commented on GitHub (Jul 15, 2026):
Duplicate of #5977, which contains the same report (same environment, same reproduction steps, same generated Xray config) opened about 11 minutes earlier by the same reporter. That issue already has a detailed root-cause investigation pointing at a silently non-fatal
IP_TRANSPARENTsetsockopt failure in Xray-core'stransport/internet/sockopt_linux.go(not a 3x-ui config-generation bug), and tags @MHSanaei.The raw INFO-level log excerpt included here is useful supporting evidence — it confirms the only
proxy/dokodemolines are the internal[api]loopback requests, with none for the LAN traffic. Please add it, along with thejournalctl -u x-ui | grep -i "IP_TRANSPARENT\|failed to apply socket options"output and a freshss -tlnp | grep 22222requested on #5977, as a comment there so all follow-up stays in one thread.Closing this copy in favor of #5977.
This reply was generated automatically; a maintainer may follow up.