Build log · WireGuard · 2026 Docker wg-easy v14 stopped at the router

The free home VPN: built, measured, then stopped

A short reel promised a free VPN out of an old laptop: run wg-easy, open one UDP port, scan a QR code. All of that is true, and I got it working — a real WireGuard handshake carrying real bytes. Then it stopped, not on a technical problem but on two facts of physics: the server has to be a machine that stays home, and the router has to have a port to forward.

Exposed to internet
1 port51820/udp, nothing else
Container image
258 MBghcr.io/wg-easy/wg-easy
Tunnel MTU
14201500 minus 80 bytes of WireGuard
Ping across it
0.72 msthree pings, 0% loss
Carried in the test
6.0 / 12.0 KiBreceived / sent, one peer
Instructions wrong
3in the version everyone copies
The constraint, in my own words

“so i need to put my mac in my house?”

Yes — and that is the whole problem. A laptop that comes to school with me is a VPN server only during the hours I do not need one. Everything below works; it just works for a machine that stays put.

Decision, 1 Dec 2026 — not deployed

What was actually running

wg-easy is a small web page with a WireGuard daemon behind it: it writes wg0.conf, runs wg-quick, mints a keypair per client and draws the QR code. The tunnel itself is the kernel's WireGuard — Docker is just the delivery mechanism, and the VM it runs inside is why a Mac can host it at all.

The server side ends up as one interface, wg0, at 10.8.0.1/24, listening on UDP 51820, with one /32 per client and a preshared key on each peer. Two iptables rules turn it from a private network into an exit: FORWARD accepts both directions, and POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE rewrites the source address on the way out. That masquerade is the entire trick — it is why a website sees the home IP and not the phone.

The path one packet takes

phone 10.8.0.2 AllowedIPs = 0.0.0.0/0 (everything goes in) │ encrypted, one UDP datagram, ~60 B overhead ▼ home router ── forward UDP 51820 ──▶ the box wg0 = 10.8.0.1/24 unwrap → source is 10.8.0.2 iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE │ ▼ internet — every site sees the home IP, and the phone's real IP never leaves the tunnel

How a session starts

1

The phone says hello to a port

One encrypted initiation packet to home-ip:51820. It contains the phone's public key and a timestamp; nothing about who it is, and nothing a passive listener can open.

2

The server recognises the key

That public key is already written in wg0.conf, because I added the client in the web UI an hour earlier. Unknown keys get no reply at all — the port is silent to a scanner reading it.

3

Both sides derive a session key

One round trip, then the handshake is over. A per-client preshared key is mixed in as well, so an attacker would need to break both. Keys rotate every two minutes.

4

Packets travel as ordinary UDP

The network in the middle sees "UDP, some port 51820" and nothing else — no hostname, no certificate, no HTTP header. That is also its weakness: a network that blocks unknown UDP, or fingerprints this exact handshake, drops it.

5

Keepalive exists to beat NAT

PersistentKeepalive is 0 by default — off. It only matters behind a NAT that forgets idle mappings; then a 25-second ping keeps the hole open from the inside.

The config that actually ran

FieldValueWhy it matters
Address10.8.0.1/24The server's own address inside the tunnel; every client gets 10.8.0.x.
ListenPort51820The one port the router must forward. WireGuard answers nothing on any other.
AllowedIPs (server)/32 per peerServer side this is the routing table: which peer owns which tunnel address. Not a firewall.
AllowedIPs (client)0.0.0.0/0, ::/0Full tunnel. Replace with 10.8.0.0/24 and only home devices go through — split tunnel.
PresharedKeyone per clientExtra symmetric secret, generated by the UI. Cheap defence against a future break in the public-key exchange.
Endpointhome-ip:51820Baked into the client config at download time — change the host and every client must be reissued.
MTU1420Set by wg-quick. Too high means fragmented packets and a tunnel that loads nothing.
NAT ruleMASQUERADEWithout it, replies have nowhere to go — the tunnel connects and then carries no traffic.

Evidence

Everything below was read out of the running system, not typed from memory.

CheckResult
Containerhealthy, wg0 up, listening port: 51820
Real handshakelatest handshake: 7 seconds ago for peer 10.8.0.3
Bytes carried6,156 received / 12,252 sent after one ping and one HTTPS fetch
Reach across the tunnelping 10.8.0.1 → 0.668 / 0.723 / 0.778 ms, 0% loss
Full-tunnel routing0.0.0.0/0 dev wg0 table 51820, fwmark 0xca6c
Admin authenticationrequiresPassword: true, login returns 200 — after the hash fix below
Published kitcompose 893 B 2d0ef5db…, README 2,441 B 86dba02f…
Reached from the internetnever — no port was forwarded at any point

Seven failures worth writing down

Each of these cost a rebuild, and each one is a symptom that looks like something else.

SymptomActual causeFix
docker compose -d → unknown shorthand flagThe CLI was installed without the compose plugin, and brew install docker-compose fell back to a source build that did not finish.Downloaded the v5.8.1 darwin-aarch64 release binary into ~/.docker/cli-plugins, chmod +x, ad-hoc codesign.
Container exits at bootv14 refuses PASSWORD outright: “DO NOT USE PASSWORD ENVIRONMENT VARIABLE”.Bcrypt hash via the image's own bcryptjs, exposed as PASSWORD_HASH.
Login 401, then requiresPassword: false and an open admin APIcompose interpolates .env, so $2a$12$… arrived as $2a$12$ plus blanks. A missing hash means “no password required”, not “locked”.Write $$ for every $ in the hash.
The same 401 again with the hash visibly present in docker inspectMy own mistake: I named the variable WG_PASSWORD_HASH. The app reads PASSWORD_HASH and never looked at mine.Rename the variable. The container had a value; the server had none.
cat: /config/wg0.conf: Is a directory and wg-quick: read errorBind-mounting a single file onto a path the image already owns as a directory.docker cp the config into a running container instead of mounting it.
Name does not resolve: 'wg-easy:51820'The test client started on the default bridge, not the compose network — a different DNS namespace.Attach it with --network and address the server by its IP.
sysctl: net.ipv4.conf.all.src_valid_mark: Read-only file system--sysctl is not honoured for that key in this runtime, and wg-quick needs it before it will install a default route.--privileged for the throwaway client container. Not something to ship.

Why it stopped

RequirementStatusWhat it would take
A machine that stays home, awakenot metAn old laptop, a desktop, a NAS or a Pi on 24/7 — or a router with a built-in WireGuard server (Asus, GL.iNet, OpenWrt), which needs no second box at all.
A forwardable public IPv4unknownRead the WAN address in the router. 100.64.x, 10.x or 172.16–31.x is carrier-grade NAT, and then there is no port to forward.
A network that lets UDP 51820 throughinconclusiveFrom this network a STUN probe to stun.l.google.com:19302 answered in 133 ms (32 B), while stun.cloudflare.com:3478 timed out — generic UDP partly passes, and a firewall can still fingerprint the handshake. One probe on one network proves little.

Two of those three are unknowable from a school network, and the third needs hardware I do not have sitting idle. So the honest result of this build is not “it did not work” — it is “it works, and it is not worth buying a box for”. The tunnel I already have over TLS on 443 does the same job from the one network I actually need it on.

The kit

docker-compose.yml — 893 B

The exact stack, with the three corrections commented in place: env_file + escaped hash, loopback-bound admin port, and the two sysctls the daemon needs. No keys, no password.

README.md — 2,441 B

The corrected recipe in order, the bcrypt command, the SSH tunnel for a headless box, and the two viability checks before anyone starts installing.

Open the build kit docker-compose.yml README.md Files

Honest limits

The tunnel was never reached from outside. Both containers lived on one machine, so the “what is my IP through the tunnel” check returned the same address either way — that test proved nothing, and the byte counters are the real evidence. No phone, no café, no NAT was involved.

The UDP probe is one sample. Two STUN servers, one network, one minute. It says nothing about the home connection, which is the one that matters.

The moving parts move. wg-easy renamed its environment variables between versions and compose changed how it treats .env; the failure table above is the diagnostic to reach for when the next version does it again. And a self-hosted exit is only as private as the network it sits on — the home IP is not anonymous, it is just mine.