A personal WireGuard VPN is the server, keys, and logs all yours. This is the manual config how-to; for the trade-offs vs commercial VPNs, the one-command wg-easy path, and the DPI caveat, see self-host WireGuard and the VPS for VPN use-case. You need a dedicated-IP plan — WireGuard listens on an inbound UDP port.
1. Install WireGuard and make server keys
apt update && apt install -y wireguard
wg genkey | tee /etc/wireguard/server.key | wg pubkey > /etc/wireguard/server.pub
chmod 600 /etc/wireguard/server.key
2. Write the server config
# /etc/wireguard/wg0.conf
[Interface]
Address = 10.8.0.1/24
ListenPort = 51820
PrivateKey = <contents of /etc/wireguard/server.key>
PostUp = iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
[Peer] # your phone/laptop
PublicKey = <client public key — see step 4>
AllowedIPs = 10.8.0.2/32
3. Enable forwarding and start it
sysctl -w net.ipv4.ip_forward=1
echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
ufw allow 51820/udp
systemctl enable --now wg-quick@wg0
wg show
4. Generate a client key and connect
On the client (or generate on the server and move it):
wg genkey | tee client.key | wg pubkey > client.pub
Put client.pub into the [Peer] block above (then systemctl restart wg-quick@wg0), and give the client this config:
[Interface]
PrivateKey = <client.key>
Address = 10.8.0.2/32
DNS = 1.1.1.1
[Peer]
PublicKey = <server.pub>
Endpoint = YOUR.SERVER.IP:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25
Import it into the WireGuard app (a QR via qrencode -t ansiutf8 < client.conf is quickest on mobile), toggle on, and you're routing through your own server.
Notes
- Behind DPI (Iran/China/Russia)? WireGuard gets fingerprinted and blocked — use VLESS + Reality instead.
- Prefer a web UI? The wg-easy one-command path sets this up with a QR-code admin panel.
Nano-IP ($8/mo) is plenty, unmetered traffic, root in about a minute, no KYC, pay in crypto.
Comments
No comments yet. Be the first.