Disclosure: this page contains affiliate links. If you buy through them we may earn a commission at no extra cost to you.

Running your own WireGuard VPN is one of the best uses of a cheap VPS — you get a private, fast tunnel you fully control for under $2 a month. This guide assumes a fresh Ubuntu 24.04 VPS.

Step 1: Get a VPS

Any KVM VPS works. RackNerd’s 1 GB annual plan ($21.99/yr) is more than enough — WireGuard is extremely light on resources.

Get a cheap VPS for WireGuard

Step 2: Update and install WireGuard

sudo apt update && sudo apt upgrade -y
sudo apt install -y wireguard

Step 3: Generate server keys

cd /etc/wireguard
wg genkey | tee server-private.key | wg pubkey > server-public.key

Step 4: Create the server config

Edit /etc/wireguard/wg0.conf:

[Interface]
Address = 10.0.0.1/24
SaveConfig = true
ListenPort = 51820
PrivateKey = <server-private-key>

[Peer]
PublicKey = <client-public-key>
AllowedIPs = 10.0.0.2/32

Step 5: Enable IP forwarding and start the tunnel

sudo sysctl -w net.ipv4.ip_forward=1
sudo systemctl enable --now wg-quick@wg0

Then configure a client (your laptop/phone) with a matching peer, and you’re done — a working WireGuard server in ~15 minutes.

Note: WireGuard uses UDP port 51820; make sure your VPS provider allows it (RackNerd, Hostinger and BandwagonHost all do). If you’re using the tunnel from mainland China, a BandwagonHost CN2 GIA plan will give you far better latency and stability.

Need China-optimized routing? See BandwagonHost