Repository navigation
Description
Integrity requirements
- I have read all the comments in the issue template and ensured that this issue meet the requirements.
- I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
- I provided the complete config and logs, rather than just providing the truncated parts based on my own judgment.
- I searched issues and did not find any similar issues.
- The problem can be successfully reproduced in the latest Release
Description
When Linux native TUN is used with autoSystemRoutingTable: ["0.0.0.0/0"] and without an explicit autoOutboundsInterface, Xray initially selects the physical outbound interface correctly. However, after a route/link update, automatic interface detection can fail.
I assume that after the TUN route is installed, a route update is emitted, which causes findOutboundInterface() to run again. After the TUN default route is installed, any later route/link update can make Xray re-run automatic outbound interface detection.
This is reproducible with freedom outbound only, so no server-side Xray instance is required.
Reproduction Method
- Use a Linux environment where Xray can create a TUN interface and manage routes.
- Make sure the existing physical IPv4 default route has a higher metric than the route Xray will install for TUN. For example:
ip -4 routeExample before starting Xray:
default via 10.94.42.1 dev eth0 metric 100
- Start Xray with the client configuration provided below. Do not manually change routes after startup.
- Optionally, in another terminal, run this before starting Xray to observe the kernel route/link events:
ip monitor route link- After Xray starts, it initially detects the physical outbound interface correctly:
[tun] update interface eth0 ...
xray_tun up
Xray 26.6.27 started
- Wait a few seconds. The system emits route/link events for the newly created TUN interface, such as xray_tun becoming UP, IPv6 link-local routes being added, and the TUN default route being installed.
- Xray then re-runs automatic outbound interface detection and fails:
[tun] failed to update interface > proxy/tun: no usable outbound interface found
No manual route changes are required to reproduce this in my test environment. The route/link events are produced by the TUN interface setup itself.
Client config
Details
{
"log": {
"loglevel": "debug",
"dnsLog": true
},
"inbounds": [
{
"tag": "tun-in",
"port": 0,
"protocol": "tun",
"settings": {
"name": "xray_tun",
"mtu": 1500,
"autoSystemRoutingTable": [
"0.0.0.0/0"
]
}
}
],
"outbounds": [
{
"tag": "direct",
"protocol": "freedom"
}
],
"routing": {
"domainStrategy": "AsIs",
"rules": [
{
"type": "field",
"process": [
"curl"
],
"outboundTag": "direct"
},
{
"type": "field",
"inboundTag": [
"tun-in"
],
"outboundTag": "direct"
}
]
}
}
Server config
No server is needed.
Client log
Details
Xray 26.6.27 (Xray, Penetrates Everything.) 45cf289 (go1.26.4 linux/amd64)
A unified platform for anti-censorship.
2026/06/30 12:16:56.761963 [Info] infra/conf/serial: Reading config: &{Name:/tmp/xray-compact.json Format:json}
2026/06/30 12:16:56.764315 [Debug] app/log: Logger started
2026/06/30 12:16:56.767334 [Info] proxy/tun: [tun] update interface eth0 488
2026/06/30 12:16:56.767374 [Info] proxy/tun: xray_tun created
2026/06/30 12:16:56.772696 [Info] proxy/tun: xray_tun up
2026/06/30 12:16:56.772858 [Warning] core: Xray 26.6.27 started
2026/06/30 12:16:58.739816 [Info] proxy/tun: [tun] failed to update interface > proxy/tun: no usable outbound interface found
2026/06/30 12:16:58.846031 [Info] proxy/tun: [tun] failed to update interface > proxy/tun: no usable outbound interface found
Server log
No server is needed.
Activity
Jasper344612 commentedon Jun 30, 2026
I will check the problem as soon as fast.
Jasper344612 commentedon Jun 30, 2026
This bug happens because the route monitor run again after the tun interface created.
Fangliding commentedon Jun 30, 2026
#6366 似乎使用了错误的方法计算默认出站 如果路由表只有一条默认通向xray tun的路由 那么可能会被过滤掉然后找不到接口 并且丢弃了详细错误
Jasper344612 commentedon Jun 30, 2026
是的,我在我的电脑上没能复现,因为在tun启动后任然有一条原来的默认路由,不过这个问题确实可能发生,我会尽快修好
TUN inbound: Fix `autoOutboundsInterface` on Linux (XTLS#6413)
Squashed commit of the following:
TUN inbound: Fix `autoOutboundsInterface` on Linux (#6413)