mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #6878] [Feature]: Allow WireGuard/AmneziaWG clients on the same inbound to reach each other (client-to-client subnet) #4568
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#4568
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 @torabi178 on GitHub (Oct 19, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6878
Describe the bug
When creating an inbound configuration using WireGuard or AmneziaWG, it is possible to specify a subnet IP and a CIDR prefix.
For example: 192.168.50.0/24
However, when creating a client, the system only allows the definition of a /32 subnet. To enable multiple clients to belong to the same network—thereby allowing them to ping one another—it should be possible to use a prefix smaller than 32 (e.g., /24). Unfortunately, this is not currently supported; the system returns an "overlap" error, and clients must be defined using a /32 subnet. As a result, these clients do not ping each other and are not placed on the same network.
This is extremely useful—and often necessary—for setting up a network that allows you to remotely access the settings of a router or the devices connected to it. It provides a simple way to connect devices to one another via a VPS.
How to reproduce the problem
I don't know how to fix it. Please help me for more information or to fix this problem.
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.10.2
Xray-core version
26.10.10
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 24.04
Which parts of the panel are affected?
Xray config generation
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 (Oct 19, 2026):
The "overlaps" error is intentional, and allowing a
/24per client would not make clients reachable from each other. Client-to-client traffic is not something either the WireGuard or the AmneziaWG inbound supports today, so I'm treating this as a feature request, not a bug.Why each client's address has to be its own host range
In this panel, a client's
allowedIPsdoes two jobs:.conf, it becomes theAddressline. Seeinternal/sub/service.go:998:If client A owned
192.168.50.0/24, the server would route the whole/24to A. Client B's traffic and replies would then be credited to, or sent to, the wrong peer. That is the bug fixed inc8a182b6, "fix(wireguard): reject allowedIPs that overlap another client's range" (closes #6623, shipped in v3.10.0). The check iswireguardAllowedIPsOverlapininternal/web/service/client_wireguard.go:197-215. It is pinned byTestDefaultWireguardClientsRejectsOverlappingAllowedIPs(internal/web/service/client_wireguard_test.go:368), whose comment says:The same check applies to AmneziaWG (
internal/web/service/client_amneziawg.go:96). This matches how WireGuard itself works: every peer on a server gets a distinct/32, even when everyone sits on one/24.Why clients still can't ping each other
The client config already sends every destination into the tunnel (
AllowedIPs = 0.0.0.0/0, ::/0,internal/sub/service.go:1065). So the client side is fine; what's missing is on the server.Neither inbound runs a routed network that forwards packets from one peer to another. In the embedded AmneziaWG runtime, every TCP connection a peer opens is accepted by a userspace netstack and handed to Xray through a loopback SOCKS relay (
internal/amneziawgnet/manager.go:208-221):Xray then sends it out through its outbounds to the real network, where
192.168.50.xdoes not exist. Nothing sends it back into the tunnel to the other peer. My understanding is that Xray's own WireGuard inbound works the same way: it terminates the tunnel and passes traffic into Xray routing, not between peers. That part is an inference, because that code lives in xray-core, not in this repository.What you can do now: for a site-to-site or "reach my router through the VPS" setup, run a plain kernel WireGuard (
wg-quick) or AmneziaWG interface on the VPS outside the panel, with IP forwarding enabled. That gives you real peer-to-peer routing. Adding client-to-client forwarding to the panel would be new functionality, and it's up to the maintainer whether to take that on.I changed the title from "[Bug]: Subnet definition not applied to client IPs for WireGuard and AmnesiaWireGuard inbound configurations" so it describes what you are actually asking for.
Verdict: Feature request
This reply was generated automatically; a maintainer may follow up.