My VPN wasn't slow, my ISP was
My VPN crawled at 32 KB/s because my ISP throttles WireGuard on UDP 51820. Moving it to UDP 443 gave 2.4 MB/s, 75x faster.
My self-hosted VPN went from 32 KB/s to 2.4 MB/s, 75x faster, after I changed one port. The cause was my home ISP throttling WireGuard on UDP 51820, not the server, the VPN software or the MTU.
The symptom
I run a WireGuard VPN with Defguard 2.x in Docker on a small VPS with 2 vCPU and 7.5 GB RAM.
Some of my admin pages only accept the VPN’s exit IP, so I use the tunnel every day.
In this post the VPN endpoint is vpn.example.com and my password manager is vault.example.com.
Small pages over the VPN felt fine.
The password manager’s web vault did not.
It loads a few MB of JavaScript and sat on a spinner for minutes.
Browser timing showed vendor.js taking 142 s, with 199 KB received.
In hindsight that pattern fits a throttle on long transfers: small pages are short, and the vault is a long download.
Ruling things out
I checked five things before I found the cause. Each one removed a suspect. The laptop commands use macOS flags, and en0 is my WiFi interface.
1. The server
I fetched the same 2.8 MB file on the server itself, pointing the hostname at localhost so the request never left the machine and never touched Cloudflare. I skipped certificate checks with -k because the request stays on the machine and the test measures speed, not trust.
# on the server
curl -sk -o /dev/null -w '%{http_code} %{size_download} %{time_total}\n' --resolve vault.example.com:443:127.0.0.1 'https://vault.example.com/<path-to-vendor.js>'
free -h
sudo dmesg | grep -i 'out of memory'
The fetch returned HTTP 200 with the full 2.8 MB in 0.075 s.
free -h showed 4.3 GB free, CPU was low, and dmesg showed no OOM kills.
Not the server.
2. The VPN or the whole connection
I downloaded the same 5 MB test file through the tunnel and around it:
# through the VPN, which carries all my traffic
curl -4 -s -o /dev/null -w '%{speed_download}\n' 'https://speed.cloudflare.com/__down?bytes=5000000'
# around the VPN, over the physical interface
curl -4 --interface en0 -s -o /dev/null -w '%{speed_download}\n' 'https://speed.cloudflare.com/__down?bytes=5000000'
Through the VPN I got about 32 KB/s. Around it I got about 2.6 MB/s. The connection was fine and the tunnel was slow, so the problem was somewhere on the tunnel path.
3. The server’s uplink
I copied a 5 MB file from the server with scp, bound to the physical interface:
scp -o BindInterface=en0 <server-ip>:<5mb-file> /tmp/
That moves raw TCP over SSH and bypasses the VPN, so it measures the path from the server to my laptop without WireGuard involved. scp’s progress meter reported 2.3 MB/s. The gateway runs WireGuard in the kernel, so the server end has no userspace process in the data path. Not the uplink.
4. MTU
My home line is PPPoE, which caps packets at 1492 bytes. WireGuard with an MTU of 1420 over IPv4 needs at most 1480. I tested the path with the don’t-fragment flag:
ping -b en0 -D -s 1464 <server-ip> # 1492-byte packets: ok
ping -b en0 -D -s 1472 <server-ip> # 1500-byte packets: fails, as expected on PPPoE
The -s flag sets the payload, and the IP and ICMP headers add 28 bytes.
That is why 1464 gives 1492-byte packets and 1472 gives 1500.
1480 fits inside 1492, so tunnel packets are not being fragmented or dropped for size.
Not the MTU.
5. Packet loss
I sent 20 pings with a 1300-byte payload, once through the tunnel and once around it:
# the server's address inside the tunnel
ping -c 20 -s 1300 <server-tunnel-ip>
ping -b en0 -c 20 -s 1300 <server-ip>
Loss through the tunnel was 0% and latency matched the direct path, at ping’s default slow rate. Not a broken link. Ping is too light to show a throttle on sustained transfers.
The one test that mattered
Five checks had removed every suspect on my side, and the tunnel was still at 32 KB/s. So I changed the network instead. I joined my phone’s hotspot with the same laptop and the same VPN.
The download ran at 2.8 MB/s.
Same laptop, same server, same tunnel, same port. Only the network changed, and the problem went away. My home ISP throttles sustained WireGuard traffic on UDP 51820. I have not confirmed this with the ISP, and I have not ruled out my home router as the place that limits it. The evidence is that moving the port fixed it, which the next section shows.
The fix
I moved WireGuard to UDP 443, the port HTTP/3 (QUIC) uses, which I expected my ISP to leave alone. It took three changes.
First, I freed the port.
Caddy was publishing 443/udp for HTTP/3.
Every site sits behind Cloudflare, which talks to my origin over TCP, so nothing used that port.
Removing it cost nothing.
Second, I changed the location in Defguard. A location’s port is both the gateway’s listen port and the endpoint clients dial, so setting it to 443 changed both.
Third, I mapped both host ports to the new container port. Old clients keep dialing 51820, and Docker forwards that port to the same container port as 443:
# docker-compose.yml, gateway service (Defguard 2.x, Nov 2026)
ports:
- "443:443/udp"
- "51820:443/udp"
Defguard’s free tier has no automatic client sync.
Each client re-added the instance once with a fresh token to switch to 443.
Clients that had not done this kept working on 51820, but at the old throttled speed.
On the server, conntrack -L -p udp then showed my laptop dialing dport=443.
Restarting the gateway drops your own tunnel, including the SSH session you would use to fix a mistake. Before the restart I opened an SSH connection that bypasses the VPN and stays open on a control socket:
ssh -o BindInterface=en0 -M -S /tmp/x.sock -fN <server-ip>
New sessions reuse that connection with ssh -S /tmp/x.sock <server-ip>, so they keep working while the tunnel is down.
Close it afterwards with ssh -S /tmp/x.sock -O exit <server-ip>.
Results
Measured on the same home WiFi, same laptop:
| Measurement | port 51820 | port 443 |
|---|---|---|
| VPN download | 32 KB/s | 2.4 MB/s |
| 2.8 MB file | stuck after 60 s | 1.1 s |
| without VPN | 2.6 MB/s | 2.9 MB/s |
2.4 MB/s is about 75 times 32 KB/s. The tunnel now runs within 0.5 MB/s of the direct line. The bottom row is a rough measure of run-to-run spread: nothing on that path changed, and it still moved from 2.6 to 2.9 MB/s.
This worked because my ISP throttles by port. An ISP that fingerprints the WireGuard handshake would need obfuscation such as wstunnel or udp2raw, which Defguard does not ship, and I have not tried either. The fix also cost one manual step per device, because every client had to re-add the instance.
What I’d do next time
- Test from a second network before changing anything, because the hotspot answered in one run what five checks could only narrow down.
- Download the same file through and around the tunnel back to back, because one pair of curl commands separates a slow VPN from a slow connection.
- Open a VPN-bypassing SSH session before restarting the gateway.