
You need
- A Linux server with a public IP and SSH.
- Your own computer with WireGuard.
- Fifteen minutes.
A pair of keys on each side
Server
sudo apt install wireguard
cd /etc/wireguard && umask 077
wg genkey | tee server.key | wg pubkey > server.pub
cat server.key server.pubOn the PC choose Add empty tunnel; the window shows a pair. One rule: your private key goes into your [Interface], your public key into the other side's [Peer].
Server config
/etc/wireguard/wg0.conf
[Interface]
Address = 10.8.0.1/24
ListenPort = 51820
PrivateKey = SERVER_PRIVATE_KEY
[Peer]
PublicKey = PC_PUBLIC_KEY
AllowedIPs = 10.8.0.2/32PC config
Paste into the new tunnel
[Interface]
PrivateKey = PC_PRIVATE_KEY
Address = 10.8.0.2/32
[Peer]
PublicKey = SERVER_PUBLIC_KEY
Endpoint = SERVER_IP:51820
AllowedIPs = 10.8.0.0/24
PersistentKeepalive = 25Open the port and start
Server
sudo ufw allow 51820/udp
sudo systemctl enable --now wg-quick@wg0Cloud servers also need UDP 51820 in the security group; many people open TCP by mistake. Then activate the tunnel on the PC.
Check
- Handshake
sudo wg showon the server prints latest handshake - Ping
ping 10.8.0.1from the PC answers - Traffictransfer is above 0 both ways
Must it be 51820?
No. Any UDP port, the same on both sides.
Too much typing?
The generator writes all files at once, with keys made in your browser.
Next letterPhone by QR