mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #6423] [Question]: Increase throughput and allow devices on vpn access to internal network. #4350
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#4350
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 @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
@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 turnsRandomTrailerson (internal/amneziawg/params.go:92,o.RandomTrailers = true). With random trailers on, amneziawg-go's handshake-size check relaxes from==to>, so a wideHrange 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 atinternal/amneziawg/params.go:110-111: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, was1024) 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 bd1c27b0returns onlydev-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.gotouchesH1-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.H1–H4with a single integer, not a range.ValidateObfuscationaccepts either (internal/amneziawg/params.go:124-129: "each accepts an integer or a100-800range"). Pick four distinct values ≥ 5 — the generator's own floor isconst lo = 5(params.go:113);1-4are vanilla WireGuard message types..conf/ re-import thevpn://link with the newH1–H4.The
tunQueueDepthhalf only comes with a build, so if you want both,x-uimenu option 3 · Update to Dev Channel (orx-ui update-dev) installsdev-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-H4defect cannot affect awireguardinbound; it has noHparameters. What you are seeing there is the architecture: neither WireGuard path in 3x-ui uses the kernel module. Awireguardinbound is xray-core's own userspace WireGuard inbound (internal/database/model/model.go:450-462converts 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 nowg-quick,wgctrlor 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:The freedom-outbound half was added in
892c06c8(2026-07-23) as SSRF hardening for #6037, and is applied to existing installs by theFreedomFinalRulesPrivateEgressBlockmigration (internal/database/db.go:1763). That migration only rewrites default rule sets —TestRewriteFreedomFinalRulesPrivateEgresshas 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/24with yours), in Xray Configs:freedomoutbound, taglan, and under Final Rules add one rule: actionallow, IP/CIDR192.168.1.0/24.192.168.1.0/24→ outboundlan, and move it above the existinggeoip:private → blockedrule. Order is first-match, which is exactly why the hardened default is block-then-allow.Equivalent JSON:
Two notes:
"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 matchinboundTaglike any other protocol.AllowedIPsmust include the subnet; the generated default0.0.0.0/0, ::/0already does.This is not written up anywhere in the docs —
docs/content/docs/en/operations/outbounds-routing.mdxshows ageoip:private → directrule 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 —
generateHRangesininternal/amneziawg/params.goemitted wideH1-H4ranges whileGenerateObfuscation31setso.RandomTrailers = true(params.go:92); amneziawg-go then misclassifies transport packets as handshakes and drops them. Second contributor:tunQueueDepth = 1024ininternal/amneziawgnet/netstack.go, overrun by many-flow slow-start. (b) LAN access — no defect:internal/web/service/config.json:71-77routesgeoip:privateto the blackhole and lines 35-38 block it again on thedirectfreedom outbound, intentional hardening from892c06c8for #6037.Already fixed:
bd1c27b0(2026-09-03, PR #6330) +24cb6bfe(2026-09-04).git tag --contains bd1c27b0→dev-latestonly; v3.7.0 (2026-08-24) predates both, so this is unreleased. Existing inbounds additionally need Regenerate + reissued client configs, since no migration rewrites storedH1-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:92o.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:113const lo = 5;params.go:124-129"each accepts an integer or a100-800range";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-38and:71-77;internal/database/db.go:1763hardenFreedomFinalRulesand:1821-1824;internal/database/freedom_finalrules_migration_test.go:51-54"customized rules are preserved";internal/web/service/xray.go:769Tag: inbound.Tag; commitbd1c27b0live-test numbers.Not determined: Whether the reporter's AmneziaWG inbound actually carries wide
H1-H4ranges — the report has no config snippet. Their inbound's fourH1-H4values pasted as text (they are not secrets) would settle it in one line: fourlow-highranges 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.