[GH-ISSUE #6423] [Question]: Increase throughput and allow devices on vpn access to internal network. #4350

Open
opened 2026-10-31 20:39:02 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @JLAnsell on GitHub (Sep 5, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6423

What are you trying to do?

Currently using Wireguard via 3x-ui v3.70 hosted at home on a raspberry pi with a 1Gbps symmetric broadband. I've tried wg-easy and WGDashboard which I had issues supporting Amnezia and Wireguard at the same time, but if I connected to someones wifi that was 100Mbps then I could easily achieve 80+ Mbps on a speed test connected via either protocol.
With 3x-ui on the same 100Mbps connection I'm struggling to achieve 20Mbps with Amnezia or Wireguard.
Is there any reason or any settings I can change?

With WGDashboard and wg-easy I could also access my internal network through the VPN but with 3x-ui I can't, I've googled and redditted but I can't find a definitive answer on how to enable access. Is it possible or is it not?

What have you already tried?

No response

3x-ui version

3.7.0

How did you install 3x-ui?

install.sh script

Operating system

Debian 13 Pi OS

Screenshots or config snippets

No response

Before submitting

  • I read the Wiki and searched existing issues.
  • This is a usage question, not a bug report.
  • This question is written in English.
Originally created by @JLAnsell on GitHub (Sep 5, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6423 ### What are you trying to do? Currently using Wireguard via 3x-ui v3.70 hosted at home on a raspberry pi with a 1Gbps symmetric broadband. I've tried wg-easy and WGDashboard which I had issues supporting Amnezia and Wireguard at the same time, but if I connected to someones wifi that was 100Mbps then I could easily achieve 80+ Mbps on a speed test connected via either protocol. With 3x-ui on the same 100Mbps connection I'm struggling to achieve 20Mbps with Amnezia or Wireguard. Is there any reason or any settings I can change? With WGDashboard and wg-easy I could also access my internal network through the VPN but with 3x-ui I can't, I've googled and redditted but I can't find a definitive answer on how to enable access. Is it possible or is it not? ### What have you already tried? _No response_ ### 3x-ui version 3.7.0 ### How did you install 3x-ui? install.sh script ### Operating system Debian 13 Pi OS ### Screenshots or config snippets _No response_ ### Before submitting - [x] I read the [Wiki](https://github.com/MHSanaei/3x-ui/wiki) and searched [existing issues](../issues?q=is%3Aissue). - [x] This is a usage question, not a bug report. - [x] This question is written in English.
Author
Owner

@github-actions[bot] commented on GitHub (Sep 5, 2026):

Two separate answers, because your two questions have unrelated causes.

1. The AmneziaWG slowness is a real bug, already diagnosed and fixed — but the fix is not in v3.7.0. Your "struggling to achieve 20 Mbps" is almost word-for-word the number in the fix commit's own live test.
2. Reaching your home LAN through the VPN is blocked on purpose by the default Xray template, and it is re-enableable with a routing rule plus one extra outbound. Recipe below.


1. AmneziaWG throughput

The panel's obfuscation generator used to pick a random range for each of H1–H4, and it always turns RandomTrailers on (internal/amneziawg/params.go:92, o.RandomTrailers = true). With random trailers on, amneziawg-go's handshake-size check relaxes from == to >, so a wide H range makes it misclassify a proportional slice of ordinary transport packets as handshakes and silently drop them (upstream: amnezia-vpn/amneziawg-go#183). The current code says so at internal/amneziawg/params.go:110-111:

// Single values, not ranges: with RandomTrailers on, a wide range misclassifies transport packets as handshakes (amnezia-vpn/amneziawg-go#183).

Fixed in bd1c27b0 (2026-09-03, PR #6330), whose commit message reports: "narrowing H1-H4 alone took AmneziaWG upload from 2-3 Mbit/s to 200+ Mbit/s on one box, and ~20 Mbit/s to 120-156 Mbit/s on another". The same commit also raised the gVisor handoff queue (internal/amneziawgnet/netstack.go:27-28, const tunQueueDepth = 8192, was 1024) because a segmented speed test's 20-28 parallel flows were overrunning it and gVisor read the silent drops as packet loss. 24cb6bfe (2026-09-04) added a further data-path allocation fix.

git tag --contains bd1c27b0 returns only dev-latest — v3.7.0 was cut 2026-08-24, ten days before the fix, so you have the bug.

What to do on v3.7.0 today, without upgrading

Nothing rewrites stored obfuscation values on upgrade (no seeder in internal/database/db.go touches H1-H4), so an inbound created on v3.7.0 keeps its wide ranges even after a panel update. Either way you have to change the values by hand or with Regenerate, and then re-issue every client config — the two ends must match.

  1. Edit the AmneziaWG inbound → obfuscation fields.
  2. Replace each of H1–H4 with a single integer, not a range. ValidateObfuscation accepts either (internal/amneziawg/params.go:124-129: "each accepts an integer or a 100-800 range"). Pick four distinct values ≥ 5 — the generator's own floor is const lo = 5 (params.go:113); 1-4 are vanilla WireGuard message types.
    H1 = 536870912
    H2 = 1073741824
    H3 = 1610612736
    H4 = 2013265920
    
  3. Re-download each client's .conf / re-import the vpn:// link with the new H1–H4.

The tunQueueDepth half only comes with a build, so if you want both, x-ui menu option 3 · Update to Dev Channel (or x-ui update-dev) installs dev-latest. That is a rolling per-commit pre-release, not a stable version — your call whether that is acceptable on your box.

2. Plain WireGuard throughput — expected, not the same bug

The H1-H4 defect cannot affect a wireguard inbound; it has no H parameters. What you are seeing there is the architecture: neither WireGuard path in 3x-ui uses the kernel module. A wireguard inbound is xray-core's own userspace WireGuard inbound (internal/database/model/model.go:450-462 converts the panel's clients into "the peers array xray-core's wireguard inbound expects"), and AmneziaWG is amneziawg-go over a gVisor userspace netstack inside the panel process (internal/amneziawgnet/netstack.go:2: "as a userspace alternative to kernel wireguard / awg-quick"). There is no wg-quick, wgctrl or netlink call anywhere in the tree. wg-easy and WGDashboard configure the in-kernel WireGuard driver, so they get kernel-crypto and zero userspace copies; on a Raspberry Pi that gap is large. Expect a userspace tunnel to stay meaningfully below kernel WireGuard even once the AmneziaWG fix is in — how far below on your specific Pi I cannot tell you, since I can't run anything here.

3. Reaching your internal network — yes, it's possible

It is blocked by default, deliberately, at two gates in the default Xray template internal/web/service/config.json:

// lines 71-77 — routing sends anything private to the blackhole
{ "ip": ["geoip:private"], "outboundTag": "blocked", "type": "field" }

// lines 35-38 — and the "direct" freedom outbound blocks it again
"finalRules": [
  { "action": "block", "ip": ["geoip:private"] },
  { "action": "allow" }
]

The freedom-outbound half was added in 892c06c8 (2026-07-23) as SSRF hardening for #6037, and is applied to existing installs by the FreedomFinalRulesPrivateEgressBlock migration (internal/database/db.go:1763). That migration only rewrites default rule sets — TestRewriteFreedomFinalRulesPrivateEgress has a "customized rules are preserved" case — so once you customise this, upgrades leave it alone.

To open just your own subnet (replace 192.168.1.0/24 with yours), in Xray Configs:

  1. Outbounds → add a freedom outbound, tag lan, and under Final Rules add one rule: action allow, IP/CIDR 192.168.1.0/24.
  2. Routing → add a rule with IP 192.168.1.0/24 → outbound lan, and move it above the existing geoip:private → blocked rule. Order is first-match, which is exactly why the hardened default is block-then-allow.

Equivalent JSON:

{ "protocol": "freedom", "tag": "lan",
  "settings": { "finalRules": [ { "action": "allow", "ip": ["192.168.1.0/24"] } ] } }
{ "type": "field", "ip": ["192.168.1.0/24"], "outboundTag": "lan" }

Two notes:

  • You can scope it to one tunnel by adding "inboundTag": ["<your AmneziaWG inbound tag>"] to that routing rule. AmneziaWG peers relay into a loopback SOCKS5 inbound that carries the AmneziaWG inbound's own tag (internal/web/service/xray.go:769, Tag: inbound.Tag), so they match inboundTag like any other protocol.
  • The client's AllowedIPs must include the subnet; the generated default 0.0.0.0/0, ::/0 already does.

This is not written up anywhere in the docs — docs/content/docs/en/operations/outbounds-routing.mdx shows a geoip:private → direct rule as an example but never explains that the shipped default blocks it in two places. That's a documentation gap worth closing.


Verdict: Already fixed
Severity: High (AmneziaWG throughput); the LAN half is not a defect
Confidence: High for the AmneziaWG root cause and the LAN block; Medium for the plain-WireGuard-vs-kernel comparison, which is architectural inference, not a measurement I can make here
Root cause: (a) Throughput — generateHRanges in internal/amneziawg/params.go emitted wide H1-H4 ranges while GenerateObfuscation31 sets o.RandomTrailers = true (params.go:92); amneziawg-go then misclassifies transport packets as handshakes and drops them. Second contributor: tunQueueDepth = 1024 in internal/amneziawgnet/netstack.go, overrun by many-flow slow-start. (b) LAN access — no defect: internal/web/service/config.json:71-77 routes geoip:private to the blackhole and lines 35-38 block it again on the direct freedom outbound, intentional hardening from 892c06c8 for #6037.
Already fixed: bd1c27b0 (2026-09-03, PR #6330) + 24cb6bfe (2026-09-04). git tag --contains bd1c27b0 → dev-latest only; v3.7.0 (2026-08-24) predates both, so this is unreleased. Existing inbounds additionally need Regenerate + reissued client configs, since no migration rewrites stored H1-H4.
Duplicate of: Related: #6303 (open, [Bug]: Low speed inbound AmneziaWG) — same root cause, the issue PR #6330 was written against. Related: #6037 (the SSRF hardening that introduced the private-IP block). Not closing as a duplicate: the LAN-access half is a separate question neither covers.
Evidence: internal/amneziawg/params.go:92 o.RandomTrailers = true; params.go:110-111 "Single values, not ranges: with RandomTrailers on, a wide range misclassifies transport packets as handshakes (amnezia-vpn/amneziawg-go#183)"; params.go:113 const lo = 5; params.go:124-129 "each accepts an integer or a 100-800 range"; internal/amneziawgnet/netstack.go:27-28 "1024 starved simultaneous TCP slow-starts; channel.Endpoint drops silently when full." / const tunQueueDepth = 8192; internal/amneziawgnet/netstack.go:2 "as a userspace alternative to kernel wireguard / awg-quick"; internal/database/model/model.go:450-462; internal/web/service/config.json:35-38 and :71-77; internal/database/db.go:1763 hardenFreedomFinalRules and :1821-1824; internal/database/freedom_finalrules_migration_test.go:51-54 "customized rules are preserved"; internal/web/service/xray.go:769 Tag: inbound.Tag; commit bd1c27b0 live-test numbers.
Not determined: Whether the reporter's AmneziaWG inbound actually carries wide H1-H4 ranges — the report has no config snippet. Their inbound's four H1-H4 values pasted as text (they are not secrets) would settle it in one line: four low-high ranges confirm this diagnosis, four single integers rule it out. Also undetermined: what plain-WireGuard throughput this Pi can reach, which no source reading can answer.

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

<!-- gh-comment-id:5552003850 --> @github-actions[bot] commented on GitHub (Sep 5, 2026): Two separate answers, because your two questions have unrelated causes. **1. The AmneziaWG slowness is a real bug, already diagnosed and fixed — but the fix is not in v3.7.0.** Your "struggling to achieve 20 Mbps" is almost word-for-word the number in the fix commit's own live test. **2. Reaching your home LAN through the VPN is blocked on purpose** by the default Xray template, and it is re-enableable with a routing rule plus one extra outbound. Recipe below. --- ## 1. AmneziaWG throughput The panel's obfuscation generator used to pick a random *range* for each of `H1`–`H4`, and it always turns `RandomTrailers` on (`internal/amneziawg/params.go:92`, `o.RandomTrailers = true`). With random trailers on, amneziawg-go's handshake-size check relaxes from `==` to `>`, so a wide `H` range makes it misclassify a proportional slice of ordinary transport packets as handshakes and silently drop them (upstream: amnezia-vpn/amneziawg-go#183). The current code says so at `internal/amneziawg/params.go:110-111`: > `// Single values, not ranges: with RandomTrailers on, a wide range misclassifies transport packets as handshakes (amnezia-vpn/amneziawg-go#183).` Fixed in **bd1c27b0** (2026-09-03, PR #6330), whose commit message reports: *"narrowing H1-H4 alone took AmneziaWG upload from 2-3 Mbit/s to 200+ Mbit/s on one box, and ~20 Mbit/s to 120-156 Mbit/s on another"*. The same commit also raised the gVisor handoff queue (`internal/amneziawgnet/netstack.go:27-28`, `const tunQueueDepth = 8192`, was `1024`) because a segmented speed test's 20-28 parallel flows were overrunning it and gVisor read the silent drops as packet loss. **24cb6bfe** (2026-09-04) added a further data-path allocation fix. `git tag --contains bd1c27b0` returns only `dev-latest` — v3.7.0 was cut 2026-08-24, ten days before the fix, so **you have the bug**. ### What to do on v3.7.0 today, without upgrading Nothing rewrites stored obfuscation values on upgrade (no seeder in `internal/database/db.go` touches `H1`-`H4`), so an inbound created on v3.7.0 keeps its wide ranges even after a panel update. Either way you have to change the values by hand or with **Regenerate**, and then **re-issue every client config** — the two ends must match. 1. Edit the AmneziaWG inbound → obfuscation fields. 2. Replace each of `H1`–`H4` with a **single integer**, not a range. `ValidateObfuscation` accepts either (`internal/amneziawg/params.go:124-129`: *"each accepts an integer or a `100-800` range"*). Pick four distinct values ≥ 5 — the generator's own floor is `const lo = 5` (`params.go:113`); `1`-`4` are vanilla WireGuard message types. ``` H1 = 536870912 H2 = 1073741824 H3 = 1610612736 H4 = 2013265920 ``` 3. Re-download each client's `.conf` / re-import the `vpn://` link with the new `H1`–`H4`. The `tunQueueDepth` half only comes with a build, so if you want both, `x-ui` menu option **3 · Update to Dev Channel** (or `x-ui update-dev`) installs `dev-latest`. That is a rolling per-commit pre-release, not a stable version — your call whether that is acceptable on your box. ## 2. Plain WireGuard throughput — expected, not the same bug The `H1`-`H4` defect cannot affect a `wireguard` inbound; it has no `H` parameters. What you are seeing there is the architecture: **neither WireGuard path in 3x-ui uses the kernel module.** A `wireguard` inbound is xray-core's own userspace WireGuard inbound (`internal/database/model/model.go:450-462` converts the panel's clients into *"the peers array xray-core's wireguard inbound expects"*), and AmneziaWG is amneziawg-go over a gVisor userspace netstack inside the panel process (`internal/amneziawgnet/netstack.go:2`: *"as a userspace alternative to kernel wireguard / awg-quick"*). There is no `wg-quick`, `wgctrl` or netlink call anywhere in the tree. wg-easy and WGDashboard configure the in-kernel WireGuard driver, so they get kernel-crypto and zero userspace copies; on a Raspberry Pi that gap is large. Expect a userspace tunnel to stay meaningfully below kernel WireGuard even once the AmneziaWG fix is in — how far below on your specific Pi I cannot tell you, since I can't run anything here. ## 3. Reaching your internal network — yes, it's possible It is blocked by default, deliberately, at **two** gates in the default Xray template `internal/web/service/config.json`: ```json // lines 71-77 — routing sends anything private to the blackhole { "ip": ["geoip:private"], "outboundTag": "blocked", "type": "field" } // lines 35-38 — and the "direct" freedom outbound blocks it again "finalRules": [ { "action": "block", "ip": ["geoip:private"] }, { "action": "allow" } ] ``` The freedom-outbound half was added in **892c06c8** (2026-07-23) as SSRF hardening for #6037, and is applied to existing installs by the `FreedomFinalRulesPrivateEgressBlock` migration (`internal/database/db.go:1763`). That migration only rewrites *default* rule sets — `TestRewriteFreedomFinalRulesPrivateEgress` has a `"customized rules are preserved"` case — so once you customise this, upgrades leave it alone. To open just your own subnet (replace `192.168.1.0/24` with yours), in **Xray Configs**: 1. **Outbounds** → add a `freedom` outbound, tag `lan`, and under **Final Rules** add one rule: action `allow`, IP/CIDR `192.168.1.0/24`. 2. **Routing** → add a rule with IP `192.168.1.0/24` → outbound `lan`, and **move it above** the existing `geoip:private → blocked` rule. Order is first-match, which is exactly why the hardened default is block-then-allow. Equivalent JSON: ```json { "protocol": "freedom", "tag": "lan", "settings": { "finalRules": [ { "action": "allow", "ip": ["192.168.1.0/24"] } ] } } ``` ```json { "type": "field", "ip": ["192.168.1.0/24"], "outboundTag": "lan" } ``` Two notes: - You can scope it to one tunnel by adding `"inboundTag": ["<your AmneziaWG inbound tag>"]` to that routing rule. AmneziaWG peers relay into a loopback SOCKS5 inbound that carries the AmneziaWG inbound's own tag (`internal/web/service/xray.go:769`, `Tag: inbound.Tag`), so they match `inboundTag` like any other protocol. - The client's `AllowedIPs` must include the subnet; the generated default `0.0.0.0/0, ::/0` already does. This is not written up anywhere in the docs — `docs/content/docs/en/operations/outbounds-routing.mdx` shows a `geoip:private → direct` rule as an example but never explains that the shipped default blocks it in two places. That's a documentation gap worth closing. --- Verdict: Already fixed Severity: High (AmneziaWG throughput); the LAN half is not a defect Confidence: High for the AmneziaWG root cause and the LAN block; Medium for the plain-WireGuard-vs-kernel comparison, which is architectural inference, not a measurement I can make here Root cause: (a) Throughput — `generateHRanges` in `internal/amneziawg/params.go` emitted wide `H1`-`H4` ranges while `GenerateObfuscation31` sets `o.RandomTrailers = true` (`params.go:92`); amneziawg-go then misclassifies transport packets as handshakes and drops them. Second contributor: `tunQueueDepth = 1024` in `internal/amneziawgnet/netstack.go`, overrun by many-flow slow-start. (b) LAN access — no defect: `internal/web/service/config.json:71-77` routes `geoip:private` to the blackhole and lines 35-38 block it again on the `direct` freedom outbound, intentional hardening from 892c06c8 for #6037. Already fixed: bd1c27b0 (2026-09-03, PR #6330) + 24cb6bfe (2026-09-04). `git tag --contains bd1c27b0` → `dev-latest` only; v3.7.0 (2026-08-24) predates both, so this is **unreleased**. Existing inbounds additionally need Regenerate + reissued client configs, since no migration rewrites stored `H1`-`H4`. Duplicate of: Related: #6303 (open, `[Bug]: Low speed inbound AmneziaWG`) — same root cause, the issue PR #6330 was written against. Related: #6037 (the SSRF hardening that introduced the private-IP block). Not closing as a duplicate: the LAN-access half is a separate question neither covers. Evidence: `internal/amneziawg/params.go:92` `o.RandomTrailers = true`; `params.go:110-111` "Single values, not ranges: with RandomTrailers on, a wide range misclassifies transport packets as handshakes (amnezia-vpn/amneziawg-go#183)"; `params.go:113` `const lo = 5`; `params.go:124-129` "each accepts an integer or a `100-800` range"; `internal/amneziawgnet/netstack.go:27-28` "1024 starved simultaneous TCP slow-starts; channel.Endpoint drops silently when full." / `const tunQueueDepth = 8192`; `internal/amneziawgnet/netstack.go:2` "as a userspace alternative to kernel wireguard / awg-quick"; `internal/database/model/model.go:450-462`; `internal/web/service/config.json:35-38` and `:71-77`; `internal/database/db.go:1763` `hardenFreedomFinalRules` and `:1821-1824`; `internal/database/freedom_finalrules_migration_test.go:51-54` "customized rules are preserved"; `internal/web/service/xray.go:769` `Tag: inbound.Tag`; commit bd1c27b0 live-test numbers. Not determined: Whether the reporter's AmneziaWG inbound actually carries wide `H1`-`H4` ranges — the report has no config snippet. Their inbound's four `H1`-`H4` values pasted as text (they are not secrets) would settle it in one line: four `low-high` ranges confirm this diagnosis, four single integers rule it out. Also undetermined: what plain-WireGuard throughput this Pi can reach, which no source reading can answer. *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
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#4350
No description provided.