WireGuard port 51820: why UDP, what TCP costs
51820 is only a habit for a WireGuard server's UDP port. We captured both sides of a NAT, then ran the tunnel inside TCP: under loss, speed held; ping did not.
Key takeaways
- 51820 is a convention: it sits in the 49152 to 65535 range that RFC 6335 says IANA never assigns.
- 12 starts with no ListenPort gave our test client 12 different ports; with ListenPort = 51820 it used 51820 every time.
- 3 of 3 runs behind a port-randomising NAT: the server saw a new port while wg show on the client still said 51820.
- 0.94 to 1.03: speed through our TCP relay against plain UDP, 0.5 to 2 percent loss, one stream, 25 November 2026.
- 20.1 ms over UDP, 507–715 ms via our TCP relay: median ping under load, 20 ms round trip, 0.5–2 percent loss.
On this page (14)
- Is WireGuard port 51820 TCP or UDP?
- Which side needs the WireGuard port open?
- What port does a WireGuard client use?
- Why does the server see a different port than the client set?
- Can two clients behind one NAT both use port 51820?
- Why can't the server reach an idle WireGuard client?
- Can you change the WireGuard port, and what breaks?
- Does WireGuard have a TCP mode?
- How much does wrapping WireGuard in TCP cost?
- Why does WireGuard over TCP add so much delay?
- Why didn't TCP over TCP melt down in our test?
- Why is WireGuard over TCP so slow in some tests?
- Which port should you open for WireGuard?
- What don't we know yet?
On 25 November 2026 we started a WireGuard client twelve times with no ListenPort line, and each start used a new UDP port, from 34268 to 60247. The server answered every one on UDP 51820, which is only the customary port for a WireGuard server: IANA never assigned it, and a client takes a random port unless you pin one.
WireGuard speaks UDP only, so the port is always a UDP port, and any free one works when both ends agree. Open it where the first packet lands, which is normally the server. The client needs nothing open. If a NAT (a router that shares one public address among many devices) sits in front of the client and rewrites its port, WireGuard follows the new one.
The port was the quick question. The long one is what the forum threads fight over: what if you push WireGuard through TCP? The project's documentation says no and blames "classically terrible" performance. We built the setup anyway. On our test machines the cost showed up in delay. Under packet loss one download kept its speed, while the median ping, normally 20 ms, rose to half a second or more.
After the port questions comes the TCP test, including the bug in our first relay that made TCP look far worse than it was in our runs.
- 12 of 12client starts with no ListenPort that came up on a new port
- 3 of 3runs behind a port-randomising NAT where the server saw a port other than the client’s 51820
- 0.94–1.03speed through our TCP relay against plain UDP, 0.5 to 2 percent loss, one stream
- 20.1 → 507–715median ping during the download, 20 ms round trip, 0.5 to 2 percent loss, plain UDP against our TCP relay
Open the film file (MP4, 5 MB). Use it if YouTube is blocked or slow on your connection. mirror
Is WireGuard port 51820 TCP or UDP?
UDP. WireGuard has no TCP mode at all, and its own tools have no default port either: 51820 is the number its documentation reaches for when it shows a server's ListenPort, and with no ListenPort line a random port is drawn.
- ListenPort
- The UDP port WireGuard listens on and also sends from. You may leave it out, and then a fresh random port is drawn whenever the interface starts (wg(8)).
WireGuard's protocol page says it flatly: "All packets are sent over UDP." As for the number, wg-quick(8) uses ListenPort = 51820 in its examples, and so does the server in the conceptual overview, where the example client listens on 21841. The Quick Start aims a peer at yet another port, 8172. No page calls 51820 required.
RFC 6335 defines 49152 to 65535 as the Dynamic Ports, "never assigned". 51820 sits inside. The IANA registry has no entry for it (we downloaded the CSV on 25 November 2026 and searched). Nothing reserves 51820 for WireGuard. A second test server, listening on 41414, worked just as well: handshake and pings in every one of three runs.
Which side needs the WireGuard port open?
Whoever gets the first packet, which in a client and server layout is the server. A client speaks first, so the answers come home along the route its own packets opened. It needs no open port and no forward.
A server doesn't need its clients' addresses written down. The overview says it learns each endpoint from where "correctly authenticated data originates". We watched that happen in every run: wg show <interface> endpoints on the server listed the address and port the packets had actually come from.
One case is hard: a server at home behind carrier-grade NAT. A port forward on your own router changes nothing there, because the provider's translator drops incoming packets before they reach it, as CGNAT and port forwarding explains. And after a handshake succeeds, the port stops being the suspect; a handshake proves less than it seems.
What port does a WireGuard client use?
A random one, drawn again at every start, unless ListenPort is set. Twelve starts with no ListenPort gave twelve distinct ports; the same twelve with ListenPort = 51820 all used 51820.
How we ran it
- Date
- 25 November 2026
- Machine
- One Linux virtual machine, kernel WireGuard, three runs of one initial start plus three interface restarts
- Addresses
- Documentation ranges only; no keys appear in any capture or log shown here
These four lines come from one run of our test script, not from WireGuard. lp is what wg show <interface> listen-port printed on the client:
STEP start lp=60247 client_sport=60247 server_sport=60247 server_dport=51820 ep=[192.0.2.2:60247] hs=yes ping=1
STEP restart1 lp=46013 client_sport=46013 server_sport=46013 server_dport=51820 ep=[192.0.2.2:46013] hs=yes ping=1
STEP restart2 lp=48161 client_sport=48161 server_sport=48161 server_dport=51820 ep=[192.0.2.2:48161] hs=yes ping=1
STEP restart3 lp=44914 client_sport=44914 server_sport=44914 server_dport=51820 ep=[192.0.2.2:44914] hs=yes ping=1
Nothing sits between client and server here, so the server saw the client's own port unchanged and stored it as the endpoint. Every one of the twelve starts completed a handshake and passed a ping. The range from 34268 to 60247 is what twelve draws happened to give; wg(8) promises only that the port is chosen randomly.
Why does the server see a different port than the client set?
A NAT in between may rewrite the client's port, and WireGuard answers the port it sees. We told a Linux NAT to randomise ports. Our client, set to 51820, then showed up at the server as 48491, 60094 and 55890 in three runs, while wg show on the client itself kept saying 51820.
That choice belongs to the NAT. Plain masquerade is the Linux rule that trades a private source address for the router's own, and it holds on to the source port when it can. Under that rule the identical client arrived as 51820 every time. We tried two rules on one Linux NAT and say nothing about home routers.
How we captured it
- Setup
- Four network namespaces on one kernel, so both captures share a clock; tcpdump on each side of the NAT
- Date
- 25 November 2026, three runs per row of the table below
- Reading the sizes
- 148 and 92 bytes are the handshake initiation and response, as the WireGuard paper gives them
One handshake from the first randomising run, as seen on both sides of the NAT:
client side 11:53:48.182452 IP 192.0.2.2.51820 > 198.51.100.2.51820: UDP, length 148
server side 11:53:48.182474 IP 198.51.100.1.48491 > 198.51.100.2.51820: UDP, length 148
server side 11:53:48.182640 IP 198.51.100.2.51820 > 198.51.100.1.48491: UDP, length 92
client side 11:53:48.182643 IP 198.51.100.2.51820 > 192.0.2.2.51820: UDP, length 92
Check the timestamps. The first packet left the client at .182452 and surfaced past the NAT at .182474, 22 microseconds later; the reply left the server at .182640 and reached the client at .182643. The NAT swapped the client's address for its own, as masquerade always does, and this time the port too: 51820 became 48491. Length and destination are untouched.
| Setup | Passed handshake and ping | Client's ListenPort | Port the server saw | Port the client used |
|---|---|---|---|---|
| No NAT, server on 51820 | 3 of 3 | unset | 51788, 49355, 42774 | same as the server saw |
| No NAT, server on 41414 | 3 of 3 | unset | 58867, 43976, 43147 | same as the server saw |
| No NAT, four starts in each run | 12 of 12 | unset | 12 ports from 34268 to 60247 | same as the server saw |
| No NAT, four starts in each run | 12 of 12 | 51820 | 51820 | 51820 |
| NAT that keeps ports | 3 of 3 | 51820 | 51820 | 51820 |
| NAT that randomises ports | 3 of 3 | 51820 | 48491, 60094, 55890 | 51820 |
| NAT that keeps ports | 3 of 3 | unset | 54721, 34617, 33510 | same as the server saw |
| Two clients behind one port-keeping NAT | 3 of 3 | 51820 on both | first client 51820; second 7011, 33288, 41499 | 51820 on both |
In every NAT row, wg show <interface> endpoints on the server listed the NAT's outside address plus that port, and never the client's own address.
Can two clients behind one NAT both use port 51820?
Yes, in our test: two clients pinned to 51820 behind one Linux NAT both worked, and the last row of the table surprised us. The NAT could not give two flows to the same server the same outside address and port, so it rewrote the second. Conntrack (Linux's connection-tracking table) records it as sport=51820 inside and dport=7011 outside. So in our test, pinning every client to 51820 caused no trouble.
Some routers keep a port and some choose a new one per destination. That split decides whether two devices can connect straight to each other, and the hole-punching post covers it.
Why can't the server reach an idle WireGuard client?
The NAT in front of it has dropped its mapping, which leaves the server's packets with no way in until the client transmits again. WireGuard then updates the endpoint to the origin of that next authenticated packet, and the origin may carry a new port.
What PersistentKeepalive is for covers the timeout itself and the cure. A caveat before the numbers: to keep runs short we shortened the NAT's UDP timeout to 30 seconds. That is a setting for the test, not a claim about any real router.
How we idled it
- Date
- 25 November 2026, three runs behind a NAT that keeps ports
- Timeout
- UDP conntrack timeout set to 30 s on purpose, no keepalive on either side, 70 s of silence
| Step | Direction | What we saw |
|---|---|---|
| Start | client to server | Handshake and ping pass; the NAT's address with port 51820 is the server's endpoint |
| 0 to 70 s | none | Silence; the mapping times out |
| 70 s | server to client | The ping fails in all three runs; the server's endpoint is still 51820 |
| Afterwards | client to server | A handshake and ping succeed in all three runs; the server sees new outside ports 43164, 45245 and 46624 (the client still sends from 51820) |
| Control run without the server's ping | client to server | Client returns on 51820 in 3 of 3 |
We got this wrong at first. With nobody else after 51820, we expected the client to return on it. It never did. The control, where the server kept quiet, brought 51820 back in all three runs. The only change was the server's own ping.
A conntrack dump from one run shows the mechanism (raw, mark=0 use=1 trimmed):
CT udp 17 26 src=192.0.2.2 dst=198.51.100.2 sport=51820 dport=51820 src=198.51.100.2 dst=198.51.100.1 sport=51820 dport=51820
idle 70s with no traffic and no keepalive
CT-after-idle entries: 0
server-to-client ping after idle: 0
CT-after-server-ping udp 17 27 src=198.51.100.2 dst=198.51.100.1 sport=51820 dport=51820 [UNREPLIED] src=198.51.100.1 dst=198.51.100.2 sport=51820 dport=51820
STEP client-after-idle lp=51820 client_sport=51820 server_sport=51849 server_dport=51820 ep=[198.51.100.1:51849] hs=yes ping=1
After the quiet period the NAT's table was empty. The server's packet aimed at the old outside port made an entry of its own, flagged [UNREPLIED], which now owned that address and port pair. The client's next packet had to take another port, 51849. That is one run, not three.
WireGuard shrugged. By the man page the peer's endpoint "will be updated automatically" to the newest source address and port of an authenticated packet, and the next ping passed every time.
Can you change the WireGuard port, and what breaks?
Yes. Choose any free UDP port as the server's ListenPort and edit each client's Endpoint (the server address and port in the client's config) to match. The 41414 server passed every check, exactly like the 51820 one. Only things that still name the old number break.
Four places hold the number:
- The server's ListenPort.
- The server's own firewall rule for that UDP port, and the provider's firewall or security group if the server is rented.
- A port forward on the home router, when the server sits behind one; it has to forward UDP, because WireGuard sends nothing over TCP.
- Each client's Endpoint.
Leave the client's own port alone.
A client pointed at the wrong port never finishes a handshake, and WireGuard's log reads the same as for a dropped port. Only a capture separates them: a wrong port tends to bring back an ICMP "port unreachable" that WireGuard ignores, while a dropped port brings back silence. Wrong port or dropped UDP shows both on the wire.
Does WireGuard have a TCP mode?
No. The Known Limitations page states that WireGuard "explicitly does not support tunneling over TCP", and gives the performance of TCP-over-TCP as the reason. A tool that carries WireGuard's packets in TCP is a separate program.
OpenVPN does offer TCP, and for some people that keeps it in use. WireGuard vs OpenVPN on TCP compares the two.
The worry is older than WireGuard. Olaf Titz laid it out in 2001 in Why TCP Over TCP Is A Bad Idea (the original address now redirects to an index page, so we link the Internet Archive copy). His argument runs in four steps:
- TCP resends when an acknowledgement is late and doubles the wait after each miss. RFC 6298 calls that "back off the timer", and it derives the wait from the measured round trip: the smoothed time plus four times its variation.
- Stack one TCP connection on another, and the outer one stalls on a lossy link while it repairs a loss.
- The inner connection's timer is shorter. No acknowledgement comes in time, so it too "will also queue a retransmission".
- The copies stack up faster than the outer connection can drain them. He calls this "an internal meltdown effect".
He wrote from experience of a link that lost "sometimes 10-20%" of packets for long periods, where stacked connections went "really slow" and broke often. We tested the idea at much lower loss.
How much does wrapping WireGuard in TCP cost?
On our test machines speed hardly moved and delay jumped. Lose 0.5 to 2 percent of packets each way, and one download through our TCP relay ran at 0.94 to 1.03 times its plain UDP speed. The median ping during that download, though, rose from 20.1 ms to between 507 and 715 ms (20 ms round trip).
The rig, in plain words: kernel WireGuard connects two Linux network namespaces. Between them our 40-line Python relay stuffs every WireGuard packet, preceded by a 2-byte length, into a single TCP connection. Linux's netem, a delay and loss emulator, supplies the round trip and the random loss each way.
How we timed UDP against TCP
- Date
- 25 November 2026; 160 runs, none failed; 5 per setting, shuffled order.
- Machine
- One Linux virtual machine (6 vCPUs, a generic virtual CPU model), Ubuntu 26.04.1, kernel 7.0.0-43, the kernel’s own WireGuard and wireguard-tools as shipped. Other workloads shared the host, so some jitter is possible.
- Path
- Two network namespaces on a virtual link (MTU 1500); netem delay for 20 and 50 ms round trips, random loss of 0, 0.5, 1 and 2 percent in each direction, no speed cap; one packet per buffer on both ends and on the tunnel so a loss hits one packet.
- Test
- One iperf3 TCP stream (CUBIC, Linux’s default, which the relay’s own connection used too) for 15 s including slow start; 40 idle pings first, then a ping every 50 ms from 1.5 s into the transfer.
- Tunnel
- MTU 1420 (Linux’s default for a 1500-byte path); a second set at 1380 and 20 ms only.
- Relay
- Our 40-line Python script, standard library only, one TCP connection with Nagle off (TCP_NODELAY); once with default socket buffers, once with an 8 MiB UDP receive buffer. The charts use the large-buffer relay; the section on why TCP looks slow in some tests explains the other.
- Figures
- Medians of five runs, except the columns marked slowest, fastest or worst
Not tested
Real Internet loss (bursts, reordering), BBR, more than one stream, a speed-capped link with its own buffer, other UDP-over-TCP tools, phones, any VPN product’s TCP transport.
| Round trip | Loss each way | TCP relay: slowest / median / fastest | Plain UDP: slowest / median / fastest |
|---|---|---|---|
| 20 ms | none | 632.1 / 635.0 / 642.4 | 781.6 / 794.5 / 813.7 |
| 20 ms | 0.5 % | 8.6 / 9.1 / 11.2 | 8.4 / 9.2 / 10.6 |
| 20 ms | 1 % | 5.9 / 6.4 / 7.0 | 6.1 / 6.2 / 6.6 |
| 20 ms | 2 % | 3.9 / 4.1 / 4.5 | 3.6 / 4.0 / 4.0 |
| 50 ms | none | 239.8 / 252.9 / 260.0 | 272.0 / 363.4 / 366.8 |
| 50 ms | 0.5 % | 3.4 / 3.7 / 5.3 | 3.5 / 3.6 / 5.5 |
| 50 ms | 1 % | 2.1 / 2.6 / 2.7 | 2.3 / 2.6 / 3.6 |
| 50 ms | 2 % | 1.4 / 1.6 / 1.7 | 1.7 / 1.7 / 2.4 |
Divide relay by UDP in the loss rows. At 20 ms, 9.1 / 9.2 is 0.99 and 6.4 / 6.2 is 1.03. At 50 ms, 1.6 / 1.7 is 0.94. In all six loss rows the minimum-to-maximum ranges overlap or touch. With no loss the ratio falls: 635.0 / 794.5 comes to 0.80, 252.9 / 363.4 to 0.70. That gap is the relay's.
At a 20 ms round trip, two percent loss leaves one stream around 4 Mbit/s with or without the relay (1.6 to 1.7 Mbit/s at 50 ms), because random loss caps a single TCP stream whatever carries it (how loss turns distance into lost speed).
So the speed was fine. The ping wasn't.
What happened to ping during the download?
| Loss each way | Relay: worst ping | Relay: 99th percentile | Relay: median | Plain UDP: median |
|---|---|---|---|---|
| none | 38.7 | 33.4 | 24.6 | 20.1 |
| 0.5 % | 1,572 | 1,456 | 715 | 20.1 |
| 1 % | 2,147 | 1,616 | 507 | 20.1 |
| 2 % | 2,570 | 2,247 | 682 | 20.1 |
At a 50 ms round trip the relay's median ping ran from 806 to 1,816 ms and its 99th percentile from 2.9 to 4.1 s, against 50.1 ms over UDP.
One limit belongs here. Our link had no speed cap, so nothing queued on the plain UDP path and its 99th percentile stayed between 20.2 and 22.2 ms. Real lines carry a buffer that fills while a download runs (ping under load shows it). Our comparison pits a queue against no queue.
Why does WireGuard over TCP add so much delay?
In our test, the outer TCP connection repaired each loss by itself, so the download riding inside never saw one and kept widening its window, and the surplus waited in our relay's queues. Across all 60 large-buffer runs, the inner download retransmitted nothing.
Where these counters come from
- Window and round trip
- iperf3’s own JSON report from the download, median of five runs, 20 ms round trip, MTU 1420; a KB here is 1,000 bytes
- Retransmissions
- The download’s own count; the outer connection’s count is an estimate (the kernel’s total minus the download’s)
- Reading
- The steps below are our interpretation of those counters, not a separate measurement
In five steps:
- A packet is lost. Over plain UDP the download's own TCP notices the gap, resends and slows down, at 63, 82 and 106 retransmissions per run for 0.5, 1 and 2 percent loss.
- Through the relay, the same loss hits the outer connection. It resends (an estimated 104, 134 and 198 segments per run) and slows down, and until each resend arrives every packet behind the lost one waits (head-of-line blocking).
- The download inside sees no loss: zero retransmissions. With nothing to react to, CUBIC keeps widening its window, which peaked at 1,695, 1,518 and 1,375 KB (the table below), where over UDP it peaked at 34, 25 and 16 KB.
- The outer connection can carry only so much, so the excess waits in the relay's UDP receive queue and in the outer connection's send buffer. The ping waited there too. The download's own round-trip estimate rose to 763, 667 and 804 ms; the ping medians were 715, 507 and 682 ms. Both rose, and we don't claim they match.
- Only one TCP connection reacts to loss in either setup: the inner one over UDP, the outer one through the relay. That is our reading of why the speeds came out so alike.
Plain UDP
- Download (TCP)
- packets
- WireGuard
- UDP
- Lossy link
- a gap
- Download sees the loss and slows
Inside our TCP relay
- Download (TCP)
- packets
- Relay queue fills
- one TCP connection
- Outer TCP repairs the loss
- delay
- Download sees only delay
| Loss each way | Biggest window over UDP | Biggest window via relay | Round trip over UDP | Round trip via relay |
|---|---|---|---|---|
| 0.5 % | 34 KB | 1,695 KB | 21 ms | 763 ms |
| 1 % | 25 KB | 1,518 KB | 21 ms | 667 ms |
| 2 % | 16 KB | 1,375 KB | 23 ms | 804 ms |
The relay is short enough to show its two loops (Python, trimmed):
def up(): # WireGuard -> TCP
while True:
d = u.recv(2048); t.sendall(struct.pack("!H", len(d)) + d)
def down(): # TCP -> WireGuard
while True:
n, = struct.unpack("!H", rd(2)); u.sendto(rd(n), WG)sendall blocks when the outer connection is full, and while it blocks nobody reads WireGuard's datagrams, which pile up in the UDP socket's queue. The 8 MiB request (16 MiB once the kernel doubles it), plus the outer connection's send buffer, holds them, and that is the half-second ping. A default-sized queue overflows; the section on slow tests below shows what that does.
Why didn't TCP over TCP melt down in our test?
Titz's meltdown needs the inner timer to expire while the outer connection is still mending. Ours never did: zero inner retransmissions show it never fired.
RFC 6298 builds the timer from the measured round trip, and the download measured 0.67 to 0.80 s. That the timer therefore stayed ahead of the queue is our inference; we did not log it. We also tested for 15 seconds at 0.5 to 2 percent loss, where Titz described 10 to 20 percent for long stretches, so we can't say what happens there.
We also shrank the tunnel MTU to 1380 so each WireGuard packet plus its 2-byte length fits one TCP segment. Nothing changed in kind: relay over UDP came to 0.96, 0.92 and 1.08 for 0.5, 1 and 2 percent loss (20 ms). Where 1420 comes from explains the default.
Why is WireGuard over TCP so slow in some tests?
In our test, because WireGuard packets were dropped at the relay's full UDP receive queue, and the TCP inside read each dropped packet as loss. With no loss on the link, our first relay managed 47.1 Mbit/s where plain UDP managed 794.5 Mbit/s (20 ms round trip).
Our first relay’s drops made TCP look slow
Our default-buffer relay carried 47.1 and 44.3 Mbit/s with no loss, against 794.5 and 363.4 over UDP (20 and 50 ms). Its UDP receive-buffer error counter tracked the download's retransmissions closely: 190 drops against 190 retransmissions, 458 against 451, 426 against 426.
Across the 40 runs of that relay, whatever the loss level, retransmissions never exceeded the relay's own drops. An 8 MiB receive buffer cut the drops to zero in every run and lifted the speed to 635.0 and 252.9 Mbit/s.
How we found it
- Counters
- The relay machine’s UDP receive-buffer errors, read from /proc/net/snmp, against the download’s own retransmission count, run by run
- Date
- 25 November 2026, same 160 runs as above
Before blaming TCP in a test of your own, read the UDP receive-buffer errors on the relay machine (the RcvbufErrors field of the Udp: line in /proc/net/snmp, or nstat -az UdpRcvbufErrors). If it climbs, you are measuring the relay.
One gap is still unexplained. Even with the big buffer and no loss, the relay reached only 0.80 and 0.70 of plain UDP's speed (20 and 50 ms). Its two processes used 13.2 CPU seconds in 15 at 20 ms but only 4.5 at 50 ms, where it fell further behind, so CPU alone doesn't explain the gap. We never traced it.
Which port should you open for WireGuard?
Open one UDP port, for incoming first packets. Four rules fall out of the runs, each tied to a number we saw:
- Open the port where the first packet arrives, the server; the client gets none (twelve client starts on random ports all worked).
- Don't set a client's ListenPort unless something has to reach that client first. Pinned or not, it works, even with two clients behind one NAT.
- If the server has to reach a quiet client, let PersistentKeepalive hold the NAT mapping open. A changed port needs no help: in our idle runs the server's endpoint moved to 43164, 45245 and 46624 by itself.
- A tunnel forced into TCP deserves a ping test under load, and a look at the relay's receive-buffer drops, before any number is believed. Under 0.5 to 2 percent loss, ours took the median ping from 20.1 ms to 507 to 715 ms.
ForestVPN vs WireGuard sets running WireGuard yourself against our app, with our tunnel engine measured against WireGuard's own implementations.
What don't we know yet?
- Loss at Titz's level, 10 to 20 percent sustained, when the outer timers have already backed off.
- Bursty or reordered loss as on the real Internet, BBR, several streams, and a capped line whose own buffer fills as well.
- The big-buffer relay's lossless deficit (0.80 and 0.70 of plain UDP). Relay CPU fits the 20 ms case, not the 50 ms one, and we haven't traced it.
- The plain UDP baseline retransmitted even with zero loss: medians of 95 at MTU 1420 and 188 at MTU 1380 (20 ms), while netem dropped nothing. Why, we don't know.
- How the outer connection repaired its losses, by fast retransmit or by timeout. We counted its resends, not their kind, and the kind decides how long each stall lasted.
- The inner timer's value. Zero retransmissions show it never fired; that the measured round trip kept it ahead of the queue is our inference.
- Real NATs: home routers and carrier NAT, with their true timeouts (we forced 30 s) and whether they re-map a port the way the Linux NAT did.
- IPv6, userspace WireGuard implementations, phones and other operating systems.
See also: Self-hosted WireGuard vs a VPN service, WireGuard AllowedIPs: two jobs, six mistakes, WireGuard handshake but no traffic: 7 causes, The server is not answering connection attempts.
Questions and answers
Do I need a static IP address for WireGuard?
Not on the client. WireGuard re-points a peer at the address and port its newest authenticated packet came from. Only the server end must be reachable at a known address. A hostname in Endpoint is resolved once and the kernel keeps the result, so with dynamic DNS something has to re-resolve it, such as the reresolve-dns script from wireguard-tools.
Can I run WireGuard on port 443?
Yes. ListenPort accepts any 16-bit port, so a server can listen on UDP 443 when nothing else on the machine uses it, and every client's Endpoint names that port. The protocol is unchanged: the packets are still WireGuard over UDP.
How do I check which port WireGuard is using?
Run wg show followed by the interface name and listen-port, for example wg show wg0 listen-port, on that machine. On a client with no ListenPort line the number changes every time the interface comes up; in our test, twelve starts gave twelve different ports.
Sources
- wg(8), the WireGuard command line tool: ListenPort and Endpoint (read November 25, 2026)
- wg-quick(8): configuration examples (read November 25, 2026)
- WireGuard: conceptual overview, Built-in Roaming (read November 25, 2026)
- WireGuard: Quick Start (read November 25, 2026)
- WireGuard: protocol and cryptography (read November 25, 2026)
- WireGuard: known limitations (TCP Mode) (read November 25, 2026)
- RFC 6335: IANA procedures for the port number registry (read November 25, 2026)
- IANA service name and transport protocol port number registry (read November 25, 2026)
- Olaf Titz: Why TCP Over TCP Is A Bad Idea (2001, Internet Archive copy) (read November 25, 2026)
- RFC 6298: Computing TCP's retransmission timer (read November 25, 2026)
- wireguard-tools: reresolve-dns README (read November 25, 2026)
How this was made
AI-assisted drafting from our own measurements of 25 November 2026 on Linux virtual machines, checked against the raw captures and runs, with automated and editorial review.