[GH-ISSUE #5977] [Bug]: Tunnel inbound listens but does not accept Linux TPROXY TCP traffic in 3x-ui 3.5.0 #4141

Closed
opened 2026-10-31 20:37:29 +07:00 by bsakaguchi · 2 comments
Owner

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

Describe the bug

A Tunnel inbound created and managed by 3x-ui is listening on the configured port, but it does not accept TCP traffic redirected by Linux nftables TPROXY.

The generated Xray configuration contains the expected settings:

"protocol": "tunnel"
"followRedirect": true
"allowedNetwork": "tcp"
"sockopt": { "tproxy": "tproxy" }

The nftables TPROXY rule matches the client traffic and its packet counter increases. The packet receives firewall mark 1, and policy routing sends marked traffic to local default dev lo table 100.

Xray is listening on the Tunnel inbound port. However, no user Tunnel/dokodemo inbound session appears in the Xray debug log, and no connection is dispatched to the configured outbound.

A Mixed inbound in the same Xray instance works correctly through the same outbound, which confirms that the Xray process, routing rule, SOCKS outbound, upstream SOCKS server, and general network connectivity are functional.

This may be related to #5956 because the affected versions are identical, but the symptom is not limited to the TProxy field being displayed incorrectly in the UI. In this case, transparent traffic is not accepted by the running Tunnel inbound.

Related issues:

#5166
#5339
#5956
Environment
Device: NanoPi NEO3 Plus
Operating system: Debian 13
Architecture: ARM
3x-ui version: 3.5.0
Xray-core version: 26.7.11
Firewall: nftables
Transparent proxy method: Linux TPROXY
LAN interface: eth0
LAN gateway address: 192.168.95.1/24
Test client: 192.168.95.181
WAN interface: eth1
Upstream SOCKS proxy: 192.168.2.44:10809
Network topology
LAN client 192.168.95.181
|
| Default gateway and DNS: 192.168.95.1
v
NanoPi eth0 192.168.95.1
|
| nftables TPROXY -> 127.0.0.1:22222
v
Xray Tunnel inbound :22222
|
| routing rule -> Local-Proxy
v
SOCKS outbound -> 192.168.2.44:10809

A separate Mixed inbound is listening on port 10809 and uses the same Local-Proxy outbound. It works correctly when configured as an explicit HTTP/SOCKS proxy on the client.

Tunnel inbound generated by 3x-ui
{
"listen": "0.0.0.0",
"port": 22222,
"protocol": "tunnel",
"settings": {
"allowedNetwork": "tcp",
"followRedirect": true,
"portMap": {}
},
"sniffing": {
"enabled": false
},
"streamSettings": {
"security": "none",
"sockopt": {
"tcpcongestion": "bbr",
"tproxy": "tproxy"
}
},
"tag": "in-22222-tcp"
}

Routing rule:

{
"type": "field",
"inboundTag": [
"in-22222-tcp"
],
"outboundTag": "Local-Proxy"
}

SOCKS outbound:

{
"protocol": "socks",
"settings": {
"servers": [
{
"address": "192.168.2.44",
"port": 10809,
"users": []
}
]
},
"tag": "Local-Proxy"
}
nftables configuration
table inet xray_tproxy {
chain divert {
type filter hook prerouting priority mangle;
policy accept;

    iifname "eth0"
    meta nfproto ipv4
    meta l4proto tcp
    socket transparent 1
    meta mark set 0x00000001
    counter
    accept
}

chain prerouting {
    type filter hook prerouting priority filter;
    policy accept;

    iifname != "eth0" return
    meta nfproto != ipv4 return
    fib daddr type local return

    ip daddr {
        0.0.0.0/8,
        100.64.0.0/10,
        127.0.0.0/8,
        169.254.0.0/16,
        192.168.95.0/24,
        224.0.0.0/3
    } return

    meta l4proto tcp
    meta mark set 0x00000001
    tproxy ip to 127.0.0.1:22222
    counter
    accept
}

}

The main TPROXY rule counter increases when the LAN client attempts TCP connections. For example, it reached:

374 packets / 19012 bytes

The divert counter remains at zero, which is consistent with no established transparent TCP session being accepted by the listener.

Policy routing
$ ip -4 rule show

0: from all lookup local
100: from all fwmark 0x1/0x1 lookup 100
32766: from all lookup main
32767: from all lookup default
$ ip -4 route show table 100

local default dev lo scope host

The route lookup for a marked packet succeeds:

$ ip -4 route get 1.1.1.1 mark 0x1

local 1.1.1.1 dev lo table 100 src 1.1.1.1 mark 1
Kernel settings
net.ipv4.ip_forward = 1
net.ipv4.conf.all.src_valid_mark = 1
net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.eth0.rp_filter = 0
net.ipv4.conf.eth1.rp_filter = 0

The required kernel modules are loaded, including:

nft_socket
nft_tproxy
nf_socket_ipv4
nf_socket_ipv6
nf_tproxy_ipv4
nf_tproxy_ipv6

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.

Listener verification
$ ss -lnptu | grep 22222

tcp LISTEN 0 4096 *:22222 : users:(("xray-linux-arm6",pid=...,fd=...))

At some stages both TCP and UDP listeners were visible, although the current diagnostic test is intentionally restricted to TCP.

Packet capture

The LAN interface receives real TCP SYN packets from the client to public destinations:

192.168.95.181: > :80 Flags [S]
192.168.95.181: > :443 Flags [S]

DNS through the gateway also works correctly and is not the cause of the TCP failure.

Xray debug log

For the non-working Tunnel inbound, there are no user requests for external destinations.

The only proxy/dokodemo messages normally visible are internal 3x-ui API requests such as:

proxy/dokodemo: received request for 127.0.0.1:
app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]

These messages are generated by the panel API and are unrelated to the LAN client traffic.

For comparison, the working Mixed inbound produces normal log messages:

proxy/http: request to Method [CONNECT] Host [example.com:443]
app/dispatcher: default route for tcp:example.com:443
transport/internet/tcp: dialing TCP to tcp:192.168.2.44:10809
Control tests

The following components have been tested successfully:

LAN connectivity to the NanoPi
DHCP default gateway
DNS through the NanoPi
Xray Mixed inbound on port 10809
Xray dispatcher
Local-Proxy SOCKS outbound
Upstream SOCKS server 192.168.2.44:10809
nftables TPROXY rule matching
Firewall mark assignment
Policy-routing rule
Local route in table 100
Xray listener on port 22222
Kernel TPROXY modules
INPUT firewall policy

The failure is localized after the nftables TPROXY rule is executed and before Xray registers a user session on the Tunnel inbound.

Additional information

3x-ui regenerates the runtime Xray configuration from its database. Manually changing the generated config.json is not a persistent workaround because the panel restores the stored Tunnel configuration after restart or save.

The final generated JSON visibly contains followRedirect: true and sockopt.tproxy: "tproxy", but it is not yet known whether the running listener receives all required socket options or whether the panel introduces another runtime/configuration difference.

A standalone Xray A/B test outside 3x-ui is planned to determine whether the same configuration works when started directly as root. I can provide the result of that test if required.

udp UNCONN 0 0 127.0.0.1:22222 0.0.0.0:* users:(("xray-linux-arm6",pid=1765,fd=41))
tcp LISTEN 0 4096 127.0.0.1:22222 0.0.0.0:* users:(("xray-linux-arm6",pid=1765,fd=34))
tcp LISTEN 0 4096 *:10809 : users:(("xray-linux-arm6",pid=1765,fd=7))
table inet xray_tproxy { # handle 8
chain divert { # handle 1
type filter hook prerouting priority mangle; policy accept;
iifname "eth0" meta nfproto ipv4 meta l4proto tcp socket transparent 1 meta mark set 0x00000001 counter packets 0 bytes 0 accept # handle 3
}

    chain prerouting { # handle 2
            type filter hook prerouting priority filter; policy accept;
            iifname != "eth0" return # handle 4
            meta nfproto != ipv4 return # handle 5
            fib daddr type local return # handle 6
            ip daddr { 0.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, 192.168.95.0/24, 224.0.0.0/3 } return # handle 8
            meta l4proto tcp meta mark set 0x00000001 tproxy ip to 127.0.0.1:22222 counter packets 3571 bytes 181488 accept # handle 9
    }

}

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

Jul 15 19:23:51 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2740964957] proxy/dokodemo: received request for 127.0.0.1:35772
Jul 15 19:23:51 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2740964957] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2045356361] proxy/dokodemo: received request for 127.0.0.1:52682
Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [4256826338] proxy/dokodemo: received request for 127.0.0.1:52674
Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [4256826338] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2045356361] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1102045541] proxy/dokodemo: received request for 127.0.0.1:52686
Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1102045541] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2226134787] proxy/http: request to Method [CONNECT] Host [plugin.saby.ru:443] with URL [//plugin.saby.ru:443]
Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3603576478] proxy/http: request to Method [CONNECT] Host [plugin.sbis.ru:443] with URL [//plugin.sbis.ru:443]
Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2226134787] app/dispatcher: sniffed domain: plugin.saby.ru
Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2226134787] app/dispatcher: default route for tcp:plugin.saby.ru:443
Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2226134787] transport/internet/tcp: dialing TCP to tcp:192.168.2.44:10809
Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3603576478] app/dispatcher: sniffed domain: plugin.sbis.ru
Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3603576478] app/dispatcher: default route for tcp:plugin.sbis.ru:443
Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3603576478] transport/internet/tcp: dialing TCP to tcp:192.168.2.44:10809
Jul 15 19:24:01 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [610705389] proxy/dokodemo: received request for 127.0.0.1:52702
Jul 15 19:24:01 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [610705389] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:24:01 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2951431171] proxy/dokodemo: received request for 127.0.0.1:52704
Jul 15 19:24:01 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2951431171] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:24:06 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2037784021] proxy/dokodemo: received request for 127.0.0.1:60692
Jul 15 19:24:06 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2037784021] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:24:06 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3090433180] proxy/dokodemo: received request for 127.0.0.1:60708
Jul 15 19:24:06 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3090433180] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:24:06 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2905120696] proxy/dokodemo: received request for 127.0.0.1:60718
Jul 15 19:24:06 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2905120696] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:24:11 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2425069275] proxy/dokodemo: received request for 127.0.0.1:60730
Jul 15 19:24:11 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2425069275] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:24:11 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2442073595] proxy/dokodemo: received request for 127.0.0.1:60740
Jul 15 19:24:11 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2442073595] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:24:16 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2874637138] proxy/dokodemo: received request for 127.0.0.1:42606
Jul 15 19:24:16 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2874637138] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:24:16 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3782003422] proxy/dokodemo: received request for 127.0.0.1:42608
Jul 15 19:24:16 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3782003422] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:24:16 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [430557128] proxy/dokodemo: received request for 127.0.0.1:42614
Jul 15 19:24:16 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [430557128] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:24:21 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1784232304] proxy/dokodemo: received request for 127.0.0.1:42626
Jul 15 19:24:21 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1784232304] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:24:21 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1663883118] proxy/dokodemo: received request for 127.0.0.1:42638
Jul 15 19:24:21 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1663883118] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:24:26 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1992688296] proxy/dokodemo: received request for 127.0.0.1:58514
Jul 15 19:24:26 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1992688296] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:24:26 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3538381499] proxy/dokodemo: received request for 127.0.0.1:58522
Jul 15 19:24:26 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3538381499] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:24:26 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1000379932] proxy/dokodemo: received request for 127.0.0.1:58528
Jul 15 19:24:26 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1000379932] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:24:31 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3331886459] proxy/dokodemo: received request for 127.0.0.1:58530
Jul 15 19:24:31 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3331886459] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]
Jul 15 19:24:31 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1188238561] proxy/dokodemo: received request for 127.0.0.1:58540
Jul 15 19:24:31 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1188238561] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789]

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)

Not applicable — runtime/network issue

Is the panel behind a reverse proxy or CDN?

None

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @Slikpro on GitHub (Jul 15, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5977 ### Describe the bug A Tunnel inbound created and managed by 3x-ui is listening on the configured port, but it does not accept TCP traffic redirected by Linux nftables TPROXY. The generated Xray configuration contains the expected settings: "protocol": "tunnel" "followRedirect": true "allowedNetwork": "tcp" "sockopt": { "tproxy": "tproxy" } The nftables TPROXY rule matches the client traffic and its packet counter increases. The packet receives firewall mark 1, and policy routing sends marked traffic to local default dev lo table 100. Xray is listening on the Tunnel inbound port. However, no user Tunnel/dokodemo inbound session appears in the Xray debug log, and no connection is dispatched to the configured outbound. A Mixed inbound in the same Xray instance works correctly through the same outbound, which confirms that the Xray process, routing rule, SOCKS outbound, upstream SOCKS server, and general network connectivity are functional. This may be related to #5956 because the affected versions are identical, but the symptom is not limited to the TProxy field being displayed incorrectly in the UI. In this case, transparent traffic is not accepted by the running Tunnel inbound. Related issues: #5166 #5339 #5956 Environment Device: NanoPi NEO3 Plus Operating system: Debian 13 Architecture: ARM 3x-ui version: 3.5.0 Xray-core version: 26.7.11 Firewall: nftables Transparent proxy method: Linux TPROXY LAN interface: eth0 LAN gateway address: 192.168.95.1/24 Test client: 192.168.95.181 WAN interface: eth1 Upstream SOCKS proxy: 192.168.2.44:10809 Network topology LAN client 192.168.95.181 | | Default gateway and DNS: 192.168.95.1 v NanoPi eth0 192.168.95.1 | | nftables TPROXY -> 127.0.0.1:22222 v Xray Tunnel inbound :22222 | | routing rule -> Local-Proxy v SOCKS outbound -> 192.168.2.44:10809 A separate Mixed inbound is listening on port 10809 and uses the same Local-Proxy outbound. It works correctly when configured as an explicit HTTP/SOCKS proxy on the client. Tunnel inbound generated by 3x-ui { "listen": "0.0.0.0", "port": 22222, "protocol": "tunnel", "settings": { "allowedNetwork": "tcp", "followRedirect": true, "portMap": {} }, "sniffing": { "enabled": false }, "streamSettings": { "security": "none", "sockopt": { "tcpcongestion": "bbr", "tproxy": "tproxy" } }, "tag": "in-22222-tcp" } Routing rule: { "type": "field", "inboundTag": [ "in-22222-tcp" ], "outboundTag": "Local-Proxy" } SOCKS outbound: { "protocol": "socks", "settings": { "servers": [ { "address": "192.168.2.44", "port": 10809, "users": [] } ] }, "tag": "Local-Proxy" } nftables configuration table inet xray_tproxy { chain divert { type filter hook prerouting priority mangle; policy accept; iifname "eth0" meta nfproto ipv4 meta l4proto tcp socket transparent 1 meta mark set 0x00000001 counter accept } chain prerouting { type filter hook prerouting priority filter; policy accept; iifname != "eth0" return meta nfproto != ipv4 return fib daddr type local return ip daddr { 0.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, 192.168.95.0/24, 224.0.0.0/3 } return meta l4proto tcp meta mark set 0x00000001 tproxy ip to 127.0.0.1:22222 counter accept } } The main TPROXY rule counter increases when the LAN client attempts TCP connections. For example, it reached: 374 packets / 19012 bytes The divert counter remains at zero, which is consistent with no established transparent TCP session being accepted by the listener. Policy routing $ ip -4 rule show 0: from all lookup local 100: from all fwmark 0x1/0x1 lookup 100 32766: from all lookup main 32767: from all lookup default $ ip -4 route show table 100 local default dev lo scope host The route lookup for a marked packet succeeds: $ ip -4 route get 1.1.1.1 mark 0x1 local 1.1.1.1 dev lo table 100 src 1.1.1.1 mark 1 Kernel settings net.ipv4.ip_forward = 1 net.ipv4.conf.all.src_valid_mark = 1 net.ipv4.conf.all.rp_filter = 0 net.ipv4.conf.default.rp_filter = 0 net.ipv4.conf.eth0.rp_filter = 0 net.ipv4.conf.eth1.rp_filter = 0 The required kernel modules are loaded, including: nft_socket nft_tproxy nf_socket_ipv4 nf_socket_ipv6 nf_tproxy_ipv4 nf_tproxy_ipv6 ### 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. Listener verification $ ss -lnptu | grep 22222 tcp LISTEN 0 4096 *:22222 *:* users:(("xray-linux-arm6",pid=...,fd=...)) At some stages both TCP and UDP listeners were visible, although the current diagnostic test is intentionally restricted to TCP. Packet capture The LAN interface receives real TCP SYN packets from the client to public destinations: 192.168.95.181:<source-port> > <public-ip>:80 Flags [S] 192.168.95.181:<source-port> > <public-ip>:443 Flags [S] DNS through the gateway also works correctly and is not the cause of the TCP failure. Xray debug log For the non-working Tunnel inbound, there are no user requests for external destinations. The only proxy/dokodemo messages normally visible are internal 3x-ui API requests such as: proxy/dokodemo: received request for 127.0.0.1:<ephemeral-port> app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] These messages are generated by the panel API and are unrelated to the LAN client traffic. For comparison, the working Mixed inbound produces normal log messages: proxy/http: request to Method [CONNECT] Host [example.com:443] app/dispatcher: default route for tcp:example.com:443 transport/internet/tcp: dialing TCP to tcp:192.168.2.44:10809 Control tests The following components have been tested successfully: LAN connectivity to the NanoPi DHCP default gateway DNS through the NanoPi Xray Mixed inbound on port 10809 Xray dispatcher Local-Proxy SOCKS outbound Upstream SOCKS server 192.168.2.44:10809 nftables TPROXY rule matching Firewall mark assignment Policy-routing rule Local route in table 100 Xray listener on port 22222 Kernel TPROXY modules INPUT firewall policy The failure is localized after the nftables TPROXY rule is executed and before Xray registers a user session on the Tunnel inbound. Additional information 3x-ui regenerates the runtime Xray configuration from its database. Manually changing the generated config.json is not a persistent workaround because the panel restores the stored Tunnel configuration after restart or save. The final generated JSON visibly contains followRedirect: true and sockopt.tproxy: "tproxy", but it is not yet known whether the running listener receives all required socket options or whether the panel introduces another runtime/configuration difference. A standalone Xray A/B test outside 3x-ui is planned to determine whether the same configuration works when started directly as root. I can provide the result of that test if required. udp UNCONN 0 0 127.0.0.1:22222 0.0.0.0:* users:(("xray-linux-arm6",pid=1765,fd=41)) tcp LISTEN 0 4096 127.0.0.1:22222 0.0.0.0:* users:(("xray-linux-arm6",pid=1765,fd=34)) tcp LISTEN 0 4096 *:10809 *:* users:(("xray-linux-arm6",pid=1765,fd=7)) table inet xray_tproxy { # handle 8 chain divert { # handle 1 type filter hook prerouting priority mangle; policy accept; iifname "eth0" meta nfproto ipv4 meta l4proto tcp socket transparent 1 meta mark set 0x00000001 counter packets 0 bytes 0 accept # handle 3 } chain prerouting { # handle 2 type filter hook prerouting priority filter; policy accept; iifname != "eth0" return # handle 4 meta nfproto != ipv4 return # handle 5 fib daddr type local return # handle 6 ip daddr { 0.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, 192.168.95.0/24, 224.0.0.0/3 } return # handle 8 meta l4proto tcp meta mark set 0x00000001 tproxy ip to 127.0.0.1:22222 counter packets 3571 bytes 181488 accept # handle 9 } } ### 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 ```shell Jul 15 19:23:51 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2740964957] proxy/dokodemo: received request for 127.0.0.1:35772 Jul 15 19:23:51 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2740964957] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2045356361] proxy/dokodemo: received request for 127.0.0.1:52682 Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [4256826338] proxy/dokodemo: received request for 127.0.0.1:52674 Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [4256826338] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2045356361] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1102045541] proxy/dokodemo: received request for 127.0.0.1:52686 Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1102045541] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2226134787] proxy/http: request to Method [CONNECT] Host [plugin.saby.ru:443] with URL [//plugin.saby.ru:443] Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3603576478] proxy/http: request to Method [CONNECT] Host [plugin.sbis.ru:443] with URL [//plugin.sbis.ru:443] Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2226134787] app/dispatcher: sniffed domain: plugin.saby.ru Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2226134787] app/dispatcher: default route for tcp:plugin.saby.ru:443 Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2226134787] transport/internet/tcp: dialing TCP to tcp:192.168.2.44:10809 Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3603576478] app/dispatcher: sniffed domain: plugin.sbis.ru Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3603576478] app/dispatcher: default route for tcp:plugin.sbis.ru:443 Jul 15 19:23:56 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3603576478] transport/internet/tcp: dialing TCP to tcp:192.168.2.44:10809 Jul 15 19:24:01 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [610705389] proxy/dokodemo: received request for 127.0.0.1:52702 Jul 15 19:24:01 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [610705389] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:24:01 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2951431171] proxy/dokodemo: received request for 127.0.0.1:52704 Jul 15 19:24:01 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2951431171] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:24:06 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2037784021] proxy/dokodemo: received request for 127.0.0.1:60692 Jul 15 19:24:06 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2037784021] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:24:06 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3090433180] proxy/dokodemo: received request for 127.0.0.1:60708 Jul 15 19:24:06 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3090433180] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:24:06 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2905120696] proxy/dokodemo: received request for 127.0.0.1:60718 Jul 15 19:24:06 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2905120696] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:24:11 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2425069275] proxy/dokodemo: received request for 127.0.0.1:60730 Jul 15 19:24:11 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2425069275] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:24:11 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2442073595] proxy/dokodemo: received request for 127.0.0.1:60740 Jul 15 19:24:11 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2442073595] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:24:16 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2874637138] proxy/dokodemo: received request for 127.0.0.1:42606 Jul 15 19:24:16 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [2874637138] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:24:16 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3782003422] proxy/dokodemo: received request for 127.0.0.1:42608 Jul 15 19:24:16 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3782003422] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:24:16 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [430557128] proxy/dokodemo: received request for 127.0.0.1:42614 Jul 15 19:24:16 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [430557128] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:24:21 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1784232304] proxy/dokodemo: received request for 127.0.0.1:42626 Jul 15 19:24:21 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1784232304] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:24:21 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1663883118] proxy/dokodemo: received request for 127.0.0.1:42638 Jul 15 19:24:21 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1663883118] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:24:26 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1992688296] proxy/dokodemo: received request for 127.0.0.1:58514 Jul 15 19:24:26 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1992688296] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:24:26 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3538381499] proxy/dokodemo: received request for 127.0.0.1:58522 Jul 15 19:24:26 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3538381499] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:24:26 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1000379932] proxy/dokodemo: received request for 127.0.0.1:58528 Jul 15 19:24:26 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1000379932] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:24:31 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3331886459] proxy/dokodemo: received request for 127.0.0.1:58530 Jul 15 19:24:31 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [3331886459] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] Jul 15 19:24:31 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1188238561] proxy/dokodemo: received request for 127.0.0.1:58540 Jul 15 19:24:31 NanoPi-NEO3-Plus /usr/local/x-ui/x-ui[1665]: INFO - XRAY: [1188238561] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:62789] ``` ### 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) Not applicable — runtime/network issue ### Is the panel behind a reverse proxy or CDN? None ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:37:29 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jul 15, 2026):

Investigated against the pinned Xray-core commit this repo builds against (go.mod: github.com/xtls/xray-core v1.260327.1-0.20260711155151-50231eaff98c, i.e. XTLS/Xray-core@50231eaff98c) and the 3x-ui config-generation path.

Title: Xray-core silently no-ops a failed IP_TRANSPARENT setsockopt on the TPROXY listener, and the listener still reports LISTEN, so a non-transparent socket is indistinguishable from a working one until real traffic is tested

Severity: Medium

Category: Reliability

Why this matters:

First, the generated config is confirmed correct, so this is not a 3x-ui config-generation bug and not a duplicate of #5956 (that one is purely a frontend edit-modal display bug for an existing sockopt.tproxy value). protocol: "tunnel", allowedNetwork, followRedirect, portMap, and streamSettings.sockopt.tproxy are exactly the field names the pinned Xray-core expects for this proxy, verified directly in infra/conf/dokodemo.go and proxy/dokodemo/config.proto. On the 3x-ui side, Listen and streamSettings (which carries sockopt) pass straight from the stored inbound into the runtime config with no rewriting (internal/web/service/inbound.go:370, Listen: r.Listen, plus the raw-JSON StreamSettings pass-through in internal/database/model/model.go).

Second, the actual failure is below the Xray proxy layer. In proxy/dokodemo/dokodemo.go, Process() only logs "received request for ..." at line 151, and with followRedirect: true it takes the destination purely from session.OutboundsFromContext(ctx) (line 114), i.e. whatever the listener already recovered as the original destination. The log in this report shows no proxy/dokodemo: received request line at all for the LAN traffic (only the unrelated internal [api] dokodemo requests on 127.0.0.1), meaning Process() is never entered for this traffic. The connection is dropped at the socket/listener level, not inside Xray routing or dispatch logic.

That points at transport/internet/sockopt_linux.go. applyInboundSocketOptions implements TPROXY with one call, setsockopt(SOL_IP, IP_TRANSPARENT, 1) (line 212). The caller in transport/internet/system_listener.go treats a failure there as non-fatal: it only logs it (line 34) and still returns a working listener (see Example). If IP_TRANSPARENT fails for any reason, Xray still binds and reports LISTEN on the port exactly as observed in this report, but the socket is not actually transparent, so the kernel has no matching socket to deliver a TPROXY connection for a foreign destination to. It is silently dropped, matching the reported symptom precisely: divert counter stays 0, connection times out.

This is not hypothetical for this repo: #2859 hit the exact log line failed to set IP_TRANSPARENT > operation not supported on a very similar dokodemo/tproxy inbound. That thread never reached a clean fix; reporters saw it resolve inconsistently (disabling AppArmor, disabling kernel MPTCP), pointing at an environment or kernel-capability interaction rather than anything the 3x-ui config controls. Also relevant: this Control callback fires once, when Xray creates the listening socket at process start or inbound hot-add, not per connection, so it would not appear in a log window captured only during later traffic tests, which is exactly the window in this report.

Recommendation:

No change is indicated in the 3x-ui config generation; it is already correct. Two things would confirm or rule out the IP_TRANSPARENT theory:

  1. Pull the Xray log from around when Xray or this inbound last (re)started, not just the traffic-test window, and search for the failure string, for example:
    journalctl -u x-ui --no-pager | grep -i "IP_TRANSPARENT\|failed to apply socket options"
    
  2. Re-run ss -tlnp | grep 22222 during the exact tcp-only test. One ss dump later in this report shows the tunnel inbound bound to 127.0.0.1:22222 rather than 0.0.0.0:22222, while the working Mixed inbound is correctly on *:10809. That may be from an earlier test stage as noted in the report, but it is worth reconfirming on the current tcp-only run, since a loopback-only bind would independently cause the same kernel-finds-no-transparent-socket failure. This is confirmed not a 3x-ui-side rewrite (see the pass-through above), so if it recurs, it is not coming from the panel config generation.

If (1) confirms IP_TRANSPARENT is failing, the fix is environment-side, not a 3x-ui code change: the shipped x-ui.service.debian has no User= or capability restriction, so an install.sh install already runs Xray as root, so the next thing to check would be AppArmor or other kernel confinement on this NanoPi or Debian 13 image. Separately worth a maintainer look regardless of outcome here: the 3x-ui process supervisor (internal/xray/process.go) never scans the Xray log output for this class of actionable, silently-non-fatal error and never surfaces it in the panel, so operators have no way to learn about it short of full debug-log analysis like this report.

Example:

// transport/internet/system_listener.go, XTLS/Xray-core@50231eaff98c, getControlFunc
if sockopt != nil {
    if err := applyInboundSocketOptions(network, fd, sockopt); err != nil {
        errors.LogInfoInner(ctx, err, "failed to apply socket options to incoming connection")
    }
}

Confidence: high that config generation is correct and that this is a listener or socket-layer failure rather than a routing or config-field problem, both directly verified in source. Moderate that IP_TRANSPARENT specifically is the failing call here: it is the best-fitting explanation given the evidence and the #2859 precedent, but unconfirmed without the startup-time log.

@MHSanaei

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

<!-- gh-comment-id:4984638345 --> @github-actions[bot] commented on GitHub (Jul 15, 2026): Investigated against the pinned Xray-core commit this repo builds against (`go.mod`: `github.com/xtls/xray-core v1.260327.1-0.20260711155151-50231eaff98c`, i.e. `XTLS/Xray-core@50231eaff98c`) and the 3x-ui config-generation path. **Title:** Xray-core silently no-ops a failed `IP_TRANSPARENT` setsockopt on the TPROXY listener, and the listener still reports `LISTEN`, so a non-transparent socket is indistinguishable from a working one until real traffic is tested **Severity:** Medium **Category:** Reliability **Why this matters:** First, the generated config is confirmed correct, so this is not a 3x-ui config-generation bug and not a duplicate of #5956 (that one is purely a frontend edit-modal display bug for an *existing* `sockopt.tproxy` value). `protocol: "tunnel"`, `allowedNetwork`, `followRedirect`, `portMap`, and `streamSettings.sockopt.tproxy` are exactly the field names the pinned Xray-core expects for this proxy, verified directly in [`infra/conf/dokodemo.go`](https://github.com/XTLS/Xray-core/blob/50231eaff98c/infra/conf/dokodemo.go) and [`proxy/dokodemo/config.proto`](https://github.com/XTLS/Xray-core/blob/50231eaff98c/proxy/dokodemo/config.proto). On the 3x-ui side, `Listen` and `streamSettings` (which carries `sockopt`) pass straight from the stored inbound into the runtime config with no rewriting (`internal/web/service/inbound.go:370`, `Listen: r.Listen`, plus the raw-JSON `StreamSettings` pass-through in `internal/database/model/model.go`). Second, the actual failure is below the Xray proxy layer. In [`proxy/dokodemo/dokodemo.go`](https://github.com/XTLS/Xray-core/blob/50231eaff98c/proxy/dokodemo/dokodemo.go), `Process()` only logs `"received request for ..."` at [line 151](https://github.com/XTLS/Xray-core/blob/50231eaff98c/proxy/dokodemo/dokodemo.go#L151), and with `followRedirect: true` it takes the destination purely from `session.OutboundsFromContext(ctx)` ([line 114](https://github.com/XTLS/Xray-core/blob/50231eaff98c/proxy/dokodemo/dokodemo.go#L114)), i.e. whatever the listener already recovered as the original destination. The log in this report shows no `proxy/dokodemo: received request` line at all for the LAN traffic (only the unrelated internal `[api]` dokodemo requests on 127.0.0.1), meaning `Process()` is never entered for this traffic. The connection is dropped at the socket/listener level, not inside Xray routing or dispatch logic. That points at [`transport/internet/sockopt_linux.go`](https://github.com/XTLS/Xray-core/blob/50231eaff98c/transport/internet/sockopt_linux.go). `applyInboundSocketOptions` implements TPROXY with one call, `setsockopt(SOL_IP, IP_TRANSPARENT, 1)` ([line 212](https://github.com/XTLS/Xray-core/blob/50231eaff98c/transport/internet/sockopt_linux.go#L212)). The caller in [`transport/internet/system_listener.go`](https://github.com/XTLS/Xray-core/blob/50231eaff98c/transport/internet/system_listener.go) treats a failure there as non-fatal: it only logs it ([line 34](https://github.com/XTLS/Xray-core/blob/50231eaff98c/transport/internet/system_listener.go#L34)) and still returns a working listener (see Example). If `IP_TRANSPARENT` fails for any reason, Xray still binds and reports `LISTEN` on the port exactly as observed in this report, but the socket is not actually transparent, so the kernel has no matching socket to deliver a TPROXY connection for a foreign destination to. It is silently dropped, matching the reported symptom precisely: divert counter stays 0, connection times out. This is not hypothetical for this repo: #2859 hit the exact log line `failed to set IP_TRANSPARENT > operation not supported` on a very similar dokodemo/tproxy inbound. That thread never reached a clean fix; reporters saw it resolve inconsistently (disabling AppArmor, disabling kernel MPTCP), pointing at an environment or kernel-capability interaction rather than anything the 3x-ui config controls. Also relevant: this `Control` callback fires once, when Xray creates the listening socket at process start or inbound hot-add, not per connection, so it would not appear in a log window captured only during later traffic tests, which is exactly the window in this report. **Recommendation:** No change is indicated in the 3x-ui config generation; it is already correct. Two things would confirm or rule out the `IP_TRANSPARENT` theory: 1. Pull the Xray log from around when Xray or this inbound last (re)started, not just the traffic-test window, and search for the failure string, for example: ``` journalctl -u x-ui --no-pager | grep -i "IP_TRANSPARENT\|failed to apply socket options" ``` 2. Re-run `ss -tlnp | grep 22222` during the exact tcp-only test. One `ss` dump later in this report shows the tunnel inbound bound to `127.0.0.1:22222` rather than `0.0.0.0:22222`, while the working Mixed inbound is correctly on `*:10809`. That may be from an earlier test stage as noted in the report, but it is worth reconfirming on the current tcp-only run, since a loopback-only bind would independently cause the same kernel-finds-no-transparent-socket failure. This is confirmed not a 3x-ui-side rewrite (see the pass-through above), so if it recurs, it is not coming from the panel config generation. If (1) confirms `IP_TRANSPARENT` is failing, the fix is environment-side, not a 3x-ui code change: the shipped `x-ui.service.debian` has no `User=` or capability restriction, so an install.sh install already runs Xray as root, so the next thing to check would be AppArmor or other kernel confinement on this NanoPi or Debian 13 image. Separately worth a maintainer look regardless of outcome here: the 3x-ui process supervisor (`internal/xray/process.go`) never scans the Xray log output for this class of actionable, silently-non-fatal error and never surfaces it in the panel, so operators have no way to learn about it short of full debug-log analysis like this report. **Example:** ```go // transport/internet/system_listener.go, XTLS/Xray-core@50231eaff98c, getControlFunc if sockopt != nil { if err := applyInboundSocketOptions(network, fd, sockopt); err != nil { errors.LogInfoInner(ctx, err, "failed to apply socket options to incoming connection") } } ``` Confidence: high that config generation is correct and that this is a listener or socket-layer failure rather than a routing or config-field problem, both directly verified in source. Moderate that `IP_TRANSPARENT` specifically is the failing call here: it is the best-fitting explanation given the evidence and the #2859 precedent, but unconfirmed without the startup-time log. @MHSanaei *This reply was generated automatically; a maintainer may follow up.*
Author
Owner

@MHSanaei commented on GitHub (Jul 23, 2026):

The panel emits the correct tunnel config; TPROXY session dispatch is core/host behavior (CAP_NET_ADMIN + policy routing), not panel-side. Closing.

<!-- gh-comment-id:5059129662 --> @MHSanaei commented on GitHub (Jul 23, 2026): The panel emits the correct tunnel config; TPROXY session dispatch is core/host behavior (CAP_NET_ADMIN + policy routing), not panel-side. Closing.
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#4141
No description provided.