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.
“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 deployedwg-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.
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.
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.
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.
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.
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.
| Field | Value | Why it matters |
|---|---|---|
Address | 10.8.0.1/24 | The server's own address inside the tunnel; every client gets 10.8.0.x. |
ListenPort | 51820 | The one port the router must forward. WireGuard answers nothing on any other. |
AllowedIPs (server) | /32 per peer | Server side this is the routing table: which peer owns which tunnel address. Not a firewall. |
AllowedIPs (client) | 0.0.0.0/0, ::/0 | Full tunnel. Replace with 10.8.0.0/24 and only home devices go through — split tunnel. |
PresharedKey | one per client | Extra symmetric secret, generated by the UI. Cheap defence against a future break in the public-key exchange. |
Endpoint | home-ip:51820 | Baked into the client config at download time — change the host and every client must be reissued. |
| MTU | 1420 | Set by wg-quick. Too high means fragmented packets and a tunnel that loads nothing. |
| NAT rule | MASQUERADE | Without it, replies have nowhere to go — the tunnel connects and then carries no traffic. |
Everything below was read out of the running system, not typed from memory.
| Check | Result |
|---|---|
| Container | healthy, wg0 up, listening port: 51820 |
| Real handshake | latest handshake: 7 seconds ago for peer 10.8.0.3 |
| Bytes carried | 6,156 received / 12,252 sent after one ping and one HTTPS fetch |
| Reach across the tunnel | ping 10.8.0.1 → 0.668 / 0.723 / 0.778 ms, 0% loss |
| Full-tunnel routing | 0.0.0.0/0 dev wg0 table 51820, fwmark 0xca6c |
| Admin authentication | requiresPassword: true, login returns 200 — after the hash fix below |
| Published kit | compose 893 B 2d0ef5db…, README 2,441 B 86dba02f… |
| Reached from the internet | never — no port was forwarded at any point |
Each of these cost a rebuild, and each one is a symptom that looks like something else.
| Symptom | Actual cause | Fix |
|---|---|---|
docker compose -d → unknown shorthand flag | The 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 boot | v14 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 API | compose 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 inspect | My 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 error | Bind-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. |
| Requirement | Status | What it would take |
|---|---|---|
| A machine that stays home, awake | not met | An 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 IPv4 | unknown | Read 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 through | inconclusive | From 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 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.
The corrected recipe in order, the bcrypt command, the SSH tunnel for a headless box, and the two viability checks before anyone starts installing.
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.