[GH-ISSUE #5110] [Bug]: Hysteria node becomes unreachable after like 1-2 hours when using port hopping, only recovers after restarting 3x-ui #3591

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

Originally created by @Tommytalk on GitHub (Jun 9, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5110

Describe the bug

After configuring port hopping for a Hysteria node, the service works normally at first.

However, after approximately 1-2 hours, all clients lose connectivity to the node. The node becomes completely unreachable.

How to reproduce the problem

configuring port forwarding (port hopping) for a Hysteria node, the service works normally at first. waiting for like 1-2 hours, it becomes completely unreachable.

Expected behavior

The Hysteria node should remain reachable indefinitely after port forwarding is configured.

Actual behavior

After 1-2 hours:

  • Hy2 cannot connect.
  • Restarting 3x-ui restores service temporarily.

Relevant logs


Screenshots

No response

3x-ui version

3.3.0 and previous

Xray-core version

No response

How did you install 3x-ui?

install.sh script

Operating system

Debian 12

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

  • 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 @Tommytalk on GitHub (Jun 9, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5110 ### Describe the bug After configuring port hopping for a Hysteria node, the service works normally at first. However, after approximately 1-2 hours, all clients lose connectivity to the node. The node becomes completely unreachable. ### How to reproduce the problem configuring port forwarding (port hopping) for a Hysteria node, the service works normally at first. waiting for like 1-2 hours, it becomes completely unreachable. ### Expected behavior The Hysteria node should remain reachable indefinitely after port forwarding is configured. ### Actual behavior After 1-2 hours: * Hy2 cannot connect. * Restarting 3x-ui restores service temporarily. ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.3.0 and previous ### Xray-core version _No response_ ### How did you install 3x-ui? install.sh script ### Operating system Debian 12 ### 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 - [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:33:33 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 9, 2026):

Thanks for the detailed report, @Tommytalk.

What the code actually does for UDP Hop

After investigating the source:

  • The UDP Hop toggle in the inbound's FinalMask → QUIC Params section stores the port range in finalmask.quicParams.udpHop.ports inside streamSettings. This is passed verbatim to xray-core and controls the QUIC-layer port hopping.
  • The subscription link generator (sub/subService.go, hysteriaHopPorts()) reads that value and emits mport=<range> on hysteria2:// share links (v2rayN-style) and ports: <range> in Clash/mihomo output.
  • 3x-ui does not set up any iptables/nftables PREROUTING rules for port forwarding. The inbound's Port field is a single integer; redirecting a port range to the listening port is handled externally (either by xray-core internally via the apernet/quic-go library, or by OS-level rules you set up yourself).

Narrowing down the 1–2 hour window

The ~1–2 hour failure is the key diagnostic clue. To help pinpoint whether this is an xray-core issue or an OS networking/iptables issue, please provide:

  1. The exact xray-core version (visible in the panel under Settings → Xray Version, or run x-ui and check the version line).
  2. Xray-core logs around the time it stops working. Enable access/error logs in Settings → Xray Config, wait for the failure, then copy the last 50–100 lines. Do the logs show any errors, or does xray appear to be running normally while clients can't connect?
  3. Does restarting only xray-core restore service? In the panel, go to the xray status section and click "Restart" (this restarts just the xray-core process, not the full 3x-ui service). If yes, this strongly suggests a bug in xray-core's port-hop state management rather than in 3x-ui.
  4. After the failure, is the base port still reachable? Try connecting a client manually on the inbound's configured port (without port hopping) to check if it is the hop ports specifically that stop working or the entire inbound.
  5. Are you managing iptables PREROUTING rules yourself to redirect the hop range to the main port? If yes, run iptables -t nat -L PREROUTING -v -n right after the failure and share the output — a common cause is these rules being flushed by ufw, firewalld, or a kernel module reload.

While you wait

If you need a temporary workaround, disabling UDP Hop (remove the udpHop block from quicParams) will make the inbound connect reliably on a single port until the root cause is confirmed.

<!-- gh-comment-id:4656501597 --> @github-actions[bot] commented on GitHub (Jun 9, 2026): Thanks for the detailed report, @Tommytalk. ## What the code actually does for UDP Hop After investigating the source: - The **`UDP Hop`** toggle in the inbound's FinalMask → QUIC Params section stores the port range in `finalmask.quicParams.udpHop.ports` inside `streamSettings`. This is passed verbatim to xray-core and controls the QUIC-layer port hopping. - The **subscription link generator** (`sub/subService.go`, `hysteriaHopPorts()`) reads that value and emits `mport=<range>` on `hysteria2://` share links (v2rayN-style) and `ports: <range>` in Clash/mihomo output. - **3x-ui does not set up any `iptables`/`nftables` PREROUTING rules** for port forwarding. The inbound's `Port` field is a single integer; redirecting a port range to the listening port is handled externally (either by xray-core internally via the `apernet/quic-go` library, or by OS-level rules you set up yourself). ## Narrowing down the 1–2 hour window The ~1–2 hour failure is the key diagnostic clue. To help pinpoint whether this is an xray-core issue or an OS networking/iptables issue, please provide: 1. **The exact xray-core version** (visible in the panel under Settings → Xray Version, or run `x-ui` and check the version line). 2. **Xray-core logs around the time it stops working.** Enable access/error logs in Settings → Xray Config, wait for the failure, then copy the last 50–100 lines. Do the logs show any errors, or does xray appear to be running normally while clients can't connect? 3. **Does restarting only xray-core restore service?** In the panel, go to the xray status section and click "Restart" (this restarts just the xray-core process, not the full 3x-ui service). If yes, this strongly suggests a bug in xray-core's port-hop state management rather than in 3x-ui. 4. **After the failure, is the base port still reachable?** Try connecting a client manually on the inbound's configured port (without port hopping) to check if it is the hop ports specifically that stop working or the entire inbound. 5. **Are you managing iptables PREROUTING rules yourself** to redirect the hop range to the main port? If yes, run `iptables -t nat -L PREROUTING -v -n` right after the failure and share the output — a common cause is these rules being flushed by `ufw`, `firewalld`, or a kernel module reload. ## While you wait If you need a temporary workaround, disabling UDP Hop (remove the `udpHop` block from quicParams) will make the inbound connect reliably on a single port until the root cause is confirmed.
Author
Owner

@MHSanaei commented on GitHub (Jun 11, 2026):

The panel side checks out: 3x-ui emits the port-hopping configuration correctly (the hop range is passed through to Xray-core and exported as mport in subscription links). The node becoming unreachable after 1-2 hours and recovering only on restart points to QUIC/port-hop state management inside Xray-core itself, not the panel. Please report this to https://github.com/XTLS/Xray-core with the core logs from around the time the node stops responding — restarting 3x-ui "fixes" it only because it restarts the Xray process. Closing here as an upstream issue.

<!-- gh-comment-id:4685773376 --> @MHSanaei commented on GitHub (Jun 11, 2026): The panel side checks out: 3x-ui emits the port-hopping configuration correctly (the hop range is passed through to Xray-core and exported as `mport` in subscription links). The node becoming unreachable after 1-2 hours and recovering only on restart points to QUIC/port-hop state management inside Xray-core itself, not the panel. Please report this to https://github.com/XTLS/Xray-core with the core logs from around the time the node stops responding — restarting 3x-ui "fixes" it only because it restarts the Xray process. Closing here as an upstream issue.
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#3591
No description provided.