Quick answer
How to set up WireGuard on a VPS?
To set up WireGuard on a VPS, install the wireguard package, generate a key pair for the server and for each device, write /etc/wireguard/wg0.conf, turn on IP forwarding, open UDP port 51820 and start wg-quick@wg0. On an IronKVM Billet, with 1 vCPU, 2 GB RAM, 40 GB NVMe, 2 TB traffic, it takes about 8 commands.
In brief
- Install with
apt install wireguardon Debian or Ubuntu. - Each side has a private key and a public key; only public keys are shared.
- The server needs IP forwarding and a NAT rule to carry your whole traffic.
AllowedIPs = 0.0.0.0/0on the client sends all IPv4 traffic through the tunnel.- Traffic counts against the plan quota: 2 TB on Billet, 4 TB on Ingot.
Which settings go on the server and which on the client?
| Setting | Server (VPS) | Client (laptop or phone) |
|---|---|---|
| Address | 10.90.90.1/24 | 10.90.90.2/24 |
| ListenPort | 51820 | not needed |
| PrivateKey | server private key | client private key |
| Peer PublicKey | client public key | server public key |
| AllowedIPs | 10.90.90.2/32 | 0.0.0.0/0 |
| Endpoint | not needed | VPS_IP:51820 |
What are the steps to set up WireGuard on a VPS?
Log in and update
Connect over SSH as root or a sudo user and run apt update and apt upgrade.
Install WireGuard
Install the wireguard package, plus iptables for the NAT rule used below.
Generate the server keys
Use wg genkey and wg pubkey with umask 077 so the private key stays readable by root only.
Find the public interface
Run ip route show default and note the interface name after dev, for example eth0.
Write wg0.conf
Create /etc/wireguard/wg0.conf with the interface address, the port, the private key and the NAT rules.
Turn on IP forwarding
Add net.ipv4.ip_forward = 1 to a file in /etc/sysctl.d and reload it.
Open the port and start
Allow 51820/udp in the firewall, then enable and start wg-quick@wg0.
Add a client
Generate a key pair on the device, add it as a peer on the server, and import the client config.
sudo apt update && sudo apt install wireguard iptables
cd /etc/wireguard
umask 077
wg genkey | tee server.key | wg pubkey > server.pub
ip route show default[Interface]
Address = 10.90.90.1/24
ListenPort = 51820
PrivateKey = CONTENTS_OF_server.key
PostUp = iptables -t nat -A POSTROUTING -s 10.90.90.0/24 -o eth0 -j MASQUERADE
PostDown = iptables -t nat -D POSTROUTING -s 10.90.90.0/24 -o eth0 -j MASQUERADE
[Peer]
PublicKey = CONTENTS_OF_client.pub
AllowedIPs = 10.90.90.2/32echo 'net.ipv4.ip_forward = 1' | sudo tee /etc/sysctl.d/70-wireguard-routing.conf
sudo sysctl --system
sudo ufw allow 51820/udp
sudo systemctl enable --now wg-quick@wg0
sudo wg showWhat goes in the client config?
The client config holds its own private key, the server’s public key, the server address and the routes to send through the tunnel. The wg-quick manual reads a file from /etc/wireguard on Linux; the official apps for Windows, macOS, Android and iOS import the same format.
Ubuntu Server documentation notes that AllowedIPs = 0.0.0.0/0 makes the VPN the default gateway. That is what you want for a personal VPN. Wireguard.com suggests PersistentKeepalive = 25 when a peer sits behind NAT, which is the case for most home and mobile connections. Set a DNS server you trust in the DNS line.
[Interface]
PrivateKey = CONTENTS_OF_client.key
Address = 10.90.90.2/24
DNS = 9.9.9.9
[Peer]
PublicKey = CONTENTS_OF_server.pub
Endpoint = VPS_IP:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25Which VPS plan is best for WireGuard?
For one person, the smallest plan is enough; traffic is the limit to watch. WireGuard runs in the kernel and needs little memory. IronKVM sets the network this way. One IPv4 address and an IPv6 /64 per VPS, on a 1 Gbit/s port. The traffic quota counts outgoing data per 30 days; past it, the port is slowed, never billed extra.
Billet gives 2 TB a month for $4.46 a month on 12 months. Billet, under $15 a month, is rented for 3 months at least. A family or a small team that streams through the tunnel may prefer Ingot, with 4 TB. According to IronKVM's survey of 16 November 2026, plans comparable to Billet cost a median of $15.00 a month across 23 hosts. The best offshore VPS for a VPN compares plans for this use.
How do you keep a WireGuard VPS safe?
Open only SSH and the WireGuard port, use SSH keys, and keep the system patched. The ufw firewall guide shows how to allow 22/tcp and 51820/udp and deny the rest. The offshore VPS security guide adds fail2ban and automatic updates.
A VPN on your own server is a privacy tool, and it is allowed. The usual rules still apply to the traffic it carries. Not allowed: spam and bulk email, phishing, malware and botnet control, DDoS and other attacks, scanning or brute-forcing systems you do not own, booter or stresser services, carding and fraud, child sexual abuse material, cryptocurrency mining, content that is illegal in the server country, and any service for sanctioned persons or companies. The country also matters, since the law of the datacenter applies; see how to choose an offshore VPS country.
WireGuard on a VPS: questions
Which port does WireGuard use?
The one set in ListenPort. 51820/udp is the usual choice in the official examples.
How do I add a second device?
Generate a new key pair on it, give it a new address such as 10.90.90.3, add a [Peer] block on the server and run systemctl reload wg-quick@wg0.
Is WireGuard the best VPN protocol for a VPS in 2026?
It is small, built into the Linux kernel and quick to set up. OpenVPN remains an option where UDP is blocked.
Does IronKVM install WireGuard for me?
No. The VPS comes with a clean Linux image and root access; you install the software.
Will my traffic be logged?
IronKVM keeps no connection logs, no traffic logs and no visitor or customer IP addresses, on this website, in the dashboard or on the VPS hosts it runs.
Verdict
- WireGuard on a VPS takes two config files and eight commands, on Debian 13 or Ubuntu 24.04.
- IronKVM Billet is enough for one user, with 2 TB a month; Ingot suits heavier use.
Sources (5)
- WireGuard quick start — WireGuard (read 2026-11-16)
- WireGuard installation — WireGuard (read 2026-11-16)
- wg-quick(8) manual — WireGuard (read 2026-11-16)
- WireGuard VPN as the default gateway — Canonical (read 2026-11-16)
- WireGuard VPN common tasks — Canonical (read 2026-11-16)
Run your own WireGuard VPN
Billet, 1 vCPU, 2 GB RAM, 40 GB NVMe, 2 TB traffic, $4.46 a month on 12 months.