📡 WireGuard Guide for Ubuntu
📂 Config Location
- Default: /etc/wireguard/wg0.conf
- File must contain at least:
[Interface]
PrivateKey = <server_private_key>
Address = 10.8.0.1/24
ListenPort = 51820
[Peer]
PublicKey = <client_public_key>
AllowedIPs = 10.8.0.2/32
▶️ Turn WireGuard ON
sudo wg-quick up wg0
⏹ Turn WireGuard OFF
sudo wg-quick down wg0
🔄 Enable on Boot
sudo systemctl enable wg-quick@wg0
Disable autostart:
sudo systemctl disable wg-quick@wg0
📊 Check Status
sudo systemctl status wg-quick@wg0
sudo wg show
⚙️ Edit Configs
sudo nano /etc/wireguard/wg0.conf
After changes, restart:
sudo wg-quick down wg0 && sudo wg-quick up wg0
✅ Quick Reference:
- up/down → start/stop
- systemctl enable/disable → auto on boot
- nano wg0.conf → change settings