Engineering notes
A WireGuard VPN server on a UK VPS: install, configure and lock down
Set up a WireGuard VPN server on a Ubuntu 24.04 or Debian 12 VPS with wg-quick. Keys, server and client configs, forwarding and NAT, firewall rules, SSH over the tunnel, and what to back up.
WireGuard is a VPN built into the Linux kernel. Its site describes it as "an extremely simple yet fast and modern VPN that utilizes state-of-the-art cryptography" (wireguard.com, checked 2026-11-18). On a VPS it is useful in two ways: as a private network that joins your laptop, phone and servers wherever they are, and as a way to send your traffic out through a fixed UK address, for example on hotel or café Wi-Fi.
It suits someone who wants a VPN they control, with a configuration they can read. There is no account, no web panel and no client software beyond WireGuard itself: each side has a key pair and a short text file.
This guide sets up one server and one client with wg-quick, the tool that ships with WireGuard. The WireGuard commands follow WireGuard's own documentation as we read it on 18 November 2026; the forwarding and NAT steps are standard Linux configuration, not from WireGuard's docs. We have not run this exact sequence on a Vozora server, so check each step against the linked pages.
What it needs
WireGuard publishes no memory or CPU figure. Its site says that it "lives inside the Linux kernel", which is why it suits "both small embedded devices like smartphones and fully loaded backbone routers". There is no application process holding memory for the tunnel. On a small server the limit is how much traffic you push through it, not the number of peers.
Vozora size: Nano (1 vCPU, 2 GB RAM, 30 GB disk). That is far more than WireGuard needs, and leaves room for a DNS resolver or another small service alongside. Specifications and current rates are on the pricing page. Pick Ubuntu 24.04 or Debian 12 when you create the server.
Install
WireGuard's install page gives one package for both distributions: sudo apt install wireguard on Ubuntu and apt install wireguard on Debian (wireguard.com, installation, checked 2026-11-18). Both Ubuntu 24.04 and Debian 12 ship the WireGuard module in their kernels, so the package only adds the tools. We also install iptables for the NAT rule below; the Ubuntu image already has it, and the Debian one may not.
sudo apt update
sudo apt install -y wireguard iptables
Keys
WireGuard's quick start generates a key pair with wg genkey and wg pubkey, after umask 077 so the private key is not readable by anyone else (wireguard.com, quick start, checked 2026-11-18). On the server, as root:
sudo -i
install -d -m 700 /etc/wireguard
cd /etc/wireguard
umask 077
wg genkey | tee server.key | wg pubkey > server.pub
The server steps from here on run in that root shell.
Generate the client's key pair on the client itself where you can, so its private key never leaves it. The WireGuard apps for Windows, macOS, iOS and Android generate keys for you when you add an empty tunnel; on a Linux client, run the same wg genkey line there. You need the client's public key for the server's config.
Server config
Find the server's public network interface, which is where outgoing traffic leaves:
ip -o -4 route show to default | awk '{print $5}'
It is often something like ens3 or eth0. Use it in place of ens3 below.
Create /etc/wireguard/wg0.conf. The private key goes in as text: paste the contents of server.key.
[Interface]
Address = 10.8.0.1/24
ListenPort = 51820
PrivateKey = <contents of server.key>
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT; iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o ens3 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT; iptables -t nat -D POSTROUTING -s 10.8.0.0/24 -o ens3 -j MASQUERADE
[Peer]
# laptop
PublicKey = <the client's public key>
AllowedIPs = 10.8.0.2/32
What each part does, from the wg-quick(8) manual (checked 2026-11-18):
Addressis the tunnel address of this server.10.8.0.0/24is a private range; pick another if it clashes with a network you use.ListenPortis the UDP port clients connect to. 51820 is the conventional one.PostUpandPostDownare "script snippets which will be executed by bash(1)" after the interface comes up or goes down, and "The special string%iis expanded to INTERFACE". Here they allow forwarding to and from the tunnel and rewrite the source address of tunnel traffic leaving the server, so replies come back to it.- In
[Peer],AllowedIPs = 10.8.0.2/32means this client may use only that one tunnel address. Each client gets its own[Peer]block and its own address.
If you only want a private network between your devices and this server, and not to route internet traffic through it, leave out the PostUp and PostDown lines and skip the forwarding step.
Turn on IPv4 forwarding so the server passes traffic on, and make it survive a reboot:
echo 'net.ipv4.ip_forward=1' > /etc/sysctl.d/99-wireguard.conf
sysctl --system
This guide tunnels IPv4 only. Routing IPv6 through the tunnel as well needs an IPv6 tunnel range, IPv6 forwarding and its own NAT or routing rules, and IPv6 forwarding changes how the server handles router advertisements, so it is a separate piece of work.
Start the tunnel now and at every boot, and check it:
systemctl enable --now wg-quick@wg0
wg show
wg show lists the interface, its listening port and the peer. Until the client connects there is no "latest handshake" line.
Client config
On the client, the config is the mirror image:
[Interface]
PrivateKey = <the client's private key>
Address = 10.8.0.2/24
DNS = <a DNS resolver you trust>
[Peer]
PublicKey = <contents of server.pub>
Endpoint = <server IPv4 address>:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25
AllowedIPs = 0.0.0.0/0on the client sends all IPv4 traffic through the tunnel; wg-quick's manual says that when this includes the default route, it "uses ip-rule(8) to handle overriding of the default gateway". To reach only the server and the tunnel network instead, useAllowedIPs = 10.8.0.0/24.PersistentKeepalivekeeps a NAT mapping open when the client sits behind a home router or mobile network. WireGuard's quick start says "A sensible interval that works with a wide variety of firewalls is 25 seconds."- Each Vozora server also has its own IPv6 address, so a client on an IPv6 network can use
[<server IPv6 address>]:51820as the endpoint. Add a matching firewall rule for it.
On a Linux client, save it as /etc/wireguard/wg0.conf and run sudo wg-quick up wg0. In the apps, paste it into the tunnel. Then wg show on the server should show a recent handshake and transfer counters going up.
Adding another client is another [Peer] block on the server with the next address, 10.8.0.3/32, and a client file with Address = 10.8.0.3/24. To load it without dropping existing connections, the manual's command is:
wg syncconf wg0 <(wg-quick strip wg0)
Lock it down
Vozora firewall. WireGuard needs one inbound rule: UDP 51820 from 0.0.0.0/0, plus ::/0 if clients connect over IPv6 (IPv4 and IPv6 rules are separate). New servers start in the default firewall, which allows all traffic, so replace its allow-everything rules with the ones you need. WireGuard's protocol page says "the server does not even respond at all to an unauthorized client; it is silent and invisible" (wireguard.com, protocol, checked 2026-11-18), so the open UDP port tells a scanner very little.
SSH over the tunnel. Once a client connects, you can reach the server at 10.8.0.1 through the tunnel. That lets you close public SSH: keep TCP 22 open only until you have confirmed ssh ubuntu@10.8.0.1 (or debian@10.8.0.1) works from the client, then remove the rule. The tunnel traffic arrives inside UDP 51820, so the Vozora firewall does not see it as SSH. If the tunnel breaks, the browser console in the Vozora dashboard still gets you in, and you can add the SSH rule back from there.
Keys, not passwords. Vozora servers log in with SSH keys as the image's user. Check that passwords are refused with ssh -o PubkeyAuthentication=no, as in our new VPS checklist.
No web interface, no HTTPS. Plain WireGuard has nothing to put behind a reverse proxy. If you add a web panel to manage peers, publish it on 127.0.0.1 or the tunnel address, not on a public port.
Remove lost devices. If a phone or laptop goes missing, delete its [Peer] block and run the syncconf line above. Its key stops working at once.
Backups
All of the state is in /etc/wireguard: the server's private key, its config and the list of peers, plus /etc/sysctl.d/99-wireguard.conf. Rebuilding a server is a fresh install plus those files. Keep a copy off the server, encrypted, because server.key is the server's identity: with it, anyone can pretend to be your VPN server to your clients.
tar czf - -C / etc/wireguard etc/sysctl.d/99-wireguard.conf | gpg -c > wireguard-$(date +%F).tar.gz.gpg
Run that as root (install gnupg first if gpg is missing), then copy the file to your own machine. gpg -c asks for a passphrase; keep it in a password manager.
Vozora's backups also cover this: turn on daily backups (taken each night, newest 7 kept), or take one with Back up now before changes. Those are stored on the same platform as the server, so the off-server copy is still worth having.
Short version
- A Nano with Ubuntu 24.04 or Debian 12.
apt install wireguard iptables, then keys withwg genkeyunderumask 077.wg0.confwith an address, port 51820, a NAT rule for the public interface and one[Peer]per client.net.ipv4.ip_forward=1, thensystemctl enable --now wg-quick@wg0.- Client config with the server's public key and endpoint,
PersistentKeepalive = 25. - Vozora firewall: UDP 51820 open; move SSH inside the tunnel once it works.
- Back up
/etc/wireguard, encrypted, off the server.
A Vozora server is billed by the minute from prepaid credit while it exists, including while stopped. Sizes and prices are on the pricing page. If you are trying to get a public address for a home connection behind CGNAT rather than a VPN out, see a static IP behind Starlink and CGNAT. For monitoring the tunnel and the services behind it, see Uptime Kuma on a UK VPS, and for the rest of a self-hosting setup, the self-hosting on a VPS guide.