mirror of
https://github.com/amnezia-vpn/amneziawg-go.git
synced 2026-12-03 18:42:09 +07:00
[GH-ISSUE #196] Feature-request: udp port multiplexing #93
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
amnezia-vpn/amneziawg-go#93
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 @RTechSn on GitHub (Sep 16, 2026).
Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-go/issues/196
Hi.
Let's look at a scenario when any UDP port gets blocked for some time after sending\receiving some amount of traffic.
But each time you make a new connection to a new port, you can still send some data.
I suggest implementing a port range option for peers with de-muxing the transport connection between multiple ports.
Next step would be making multiple connections and stagger them in time.
For each of multiple connections peers pick a random port number from specified range. When one of the connections gets blocked, packets would seamlessly go through another one.
When a dead connection is detected, peer makes a new one on a random port from the range.
Even better, if you could specify multiple IP's if your server has them.
I've done some tests on a vibe-coded tunnel and it works even if you manage to send only a couple of kilobytes per connection.
@anphsw commented on GitHub (Oct 14, 2026):
Very useful feature, it needs to implemented in user-level.
On kernel-level you can use (nftables example):
source port randomize:
type nat hook postrouting priority srcnat ->
udp dport xxxx masquerade fully-random
dst port randomize:
map nftable_testmap{ type mark:inet_service; elements = { 0: ....., 1: .... , ..... , 7: ...... }
type nat hook output priority 0 ->
udp dport xxxx dnat to : numgen random mod 8 map @nftables_testmap
@RTechSn commented on GitHub (Oct 15, 2026):
I think port block would lead to a packet loss in this case.
AWG needs to be aware which ports are still alive, close the connection on them and open new ones.
The tunnel data should flow without interruption even if you can send just a couple of kilobytes per port.