mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5152] [Bug]: Outbound connection test fails when eth0 has no internet and default route is via tun0 #3621
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#3621
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 @iran100 on GitHub (Jun 9, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5152
Describe the bug
In version 2.9.3, the Outbound connection test worked perfectly and showed the correct latency. However, since upgrading to v3.3.0, the test (for all outbounds like Armenia, SamanTel Socks) always returns "Failed", even though all tunnels and outbound connections are fully functional for clients. This issue only happens because the server architecture routes all internet traffic via a VPN interface (
tun0), leaving the primaryeth0interface with no direct internet access.How to reproduce the problem
eth0) has no internet connection.tun0the default route for all traffic.Expected behavior
I expected the panel's test mechanism to follow the system's default routing table (respecting
tun0) and show the correct latency (ms), rather than strict-binding or forcing test packets via the internet-lesseth0interface.Actual behavior
The panel incorrectly shows "Failed" for all healthy outbound connections because it cannot successfully send test packets via the primary, but internet-less,
eth0interface.Relevant logs
Screenshots
No response
3x-ui version
3.3.0
Xray-core version
No response
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 26.04
Which parts of the panel are affected?
No response
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 (Jun 9, 2026):
Thanks for the detailed report and reproduction steps.
What changed between v2.x and v3.x
The outbound test feature was completely rewritten in v3.x. v2.9.3 used a different mechanism; v3.x runs a temporary, standalone xray process just for each test and uses xray's
burstObservatoryto probe the outbound. The relevant code is inweb/service/outbound.go(testOutboundHTTP/testOutboundTCP).What the two test modes actually do
TCP mode (
web/service/outbound.go:219): extracts the proxy server'saddress:portand dials it withnet.DialTimeout. This goes through Go's standard network stack, so it does respect the OS routing table (includingtun0as default route). TCP mode should reach remote proxy servers even wheneth0has no internet.HTTP mode (
web/service/outbound.go:323): starts a temp xray binary, configures aburstObservatorywithpingConfig.connectivity = ""(which in xray-core means "skip the connectivity pre-check and proceed directly"), and pollshttp://127.0.0.1:<random-port>/debug/varsfor up to 12 seconds waiting foralive: true.How to get the real error message
The UI only shows "Failed"; the full reason is in the API response. To capture it:
POST /xray/testOutboundrequest and read the JSON response body — it contains an"error"field with the actual cause.Common messages to look for:
"Xray process exited: ..."— the temp xray binary crashed on start; the message after the colon is the last log line."Xray failed to start metrics listener"— the metrics port never became available within 5 s."Probe timed out — outbound did not become reachable"— the xray process started fine but the probe never returnedalive: truewithin 12 s."All probes failed (last attempt Xs ago)"— xray started, ran the probe, and the probe itself failed.The exact message will tell us which stage is failing.
Possible causes in your specific setup
A few scenarios that are consistent with eth0-less / tun0-routed VPS:
Probe destination blocked on the outbound servers' side: The HTTP test sends a request to
https://www.google.com/generate_204through the outbound. If Google is unreachable from the outbound proxy servers (firewall, geo-block), the probe fails even though clients' general traffic works. Try changing the test URL in Settings → Xray Settings → Outbound Test URL to something reachable from those servers (e.g.,http://cp.cloudflare.com/or any URL that returns 2xx from your outbound servers' egress).WireGuard outbound with
noKernelTun: If any outbound under test is WireGuard, the code forcesnoKernelTun: truein the temp config to avoid creating a second tun device. If the kernel and userspace WireGuard behave differently on your VPS (e.g., different UDP socket binding), the temp process may fail to establish the WireGuard handshake. Try testing a non-WireGuard outbound first to isolate.Timing: The burstObservatory
timeoutis 5 s per probe. If the round-trip through tun0 + the remote proxy adds enough latency to exceed 5 s, the probe is recorded as failed. You can verify this by checking whether a lower-latency outbound (if any) succeeds.What to share for further diagnosis
To pinpoint the issue, please provide:
"error"field from the API response (DevTools steps above)."mode"field of the response).journalctl -u x-ui -n 50 --no-pagerright after running a test — the temp xray process logs to the same journal.