01
What a VPN on your VPS is for
- encrypting your connection on hotel, station or café Wi-Fi;
- going out with a fixed IP address, the VPS's, to reach a service that filters by address;
- linking your devices and servers on a private network: an admin interface or a database stays invisible from the Internet and reachable through the VPN.
It is not an anonymity tool: the VPS is rented in your name and its address is tied to you.
02
The right VPS for WireGuard
WireGuard runs in the Linux kernel. On a full virtual machine (KVM) or a dedicated server, it installs directly. In a container VPS (LXC), the module depends on the host machine: its kernel must provide WireGuard and the container must be allowed to create the interface.
On our Ryzen and Intel VPS, that is the case: creating the interface, the tunnel and the wg-quick service with connection sharing (MASQUERADE) work there as in this guide.
A VPN needs very few resources: the smallest tier is enough for a few devices. What matters is the network and proximity: a VPS in France for use from France.
03
Installing WireGuard and creating the keys
On Debian or Ubuntu:
sudo apt update && sudo apt install -y wireguard qrencode
cd /etc/wireguard && umask 077
wg genkey | tee serveur.key | wg pubkey > serveur.pub
wg genkey | tee tel.key | wg pubkey > tel.pub
Each device has its own key pair: the private key (.key) never leaves the device it belongs to, the public key (.pub) is given to the other end.
04
Configuring the server
Find the name of the VPS's public network interface with ip route (often eth0 or ens18), then create /etc/wireguard/wg0.conf:
[Interface]
Address = 10.8.0.1/24
ListenPort = 51820
PrivateKey = (content of serveur.key)
PostUp = iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
PostDown = iptables -t nat -D POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
[Peer]
# Phone
PublicKey = (content of tel.pub)
AllowedIPs = 10.8.0.2/32
Allow the VPS to forward your devices' traffic, open the port, then start the VPN:
echo 'net.ipv4.ip_forward=1' | sudo tee /etc/sysctl.d/99-wireguard.conf
sudo sysctl --system
sudo ufw allow 51820/udp
sudo systemctl enable --now wg-quick@wg0
05
Configuring the phone or computer
Write the device configuration in a tel.conf file:
[Interface]
PrivateKey = (content of tel.key)
Address = 10.8.0.2/24
DNS = 1.1.1.1, 8.8.8.8
[Peer]
PublicKey = (content of serveur.pub)
Endpoint = vps-ip-address:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25
AllowedIPs = 0.0.0.0/0 sends all traffic through the VPN; to send only the private network through it, use 10.8.0.0/24. On a phone, the official WireGuard app reads the configuration by QR code: qrencode -t ansiutf8 < tel.conf shows it in the terminal. Then delete tel.key and tel.conf from the server.
For each new device: a new key pair, the next address (10.8.0.3…) and a new [Peer] block on the server.
06
Troubleshooting
sudo wg show shows, for each device, the time of the last exchange (latest handshake). If there has never been one: check UDP port 51820, the server address and the public keys, often swapped.
- The connection comes up but nothing loads: check
ip_forward and the interface name in the MASQUERADE rule.
- Some sites only half load: lower the packet size with
MTU = 1380 in the device's [Interface] section.
07
A VPN on a CloudFive VPS
The Ryzen VPS and the Intel VPS accept WireGuard from the smallest tier, with a dedicated IP address in France and root access. They share the host machine's kernel: for a VPN that needs another kernel module, choose a dedicated server, with its own kernel. Remember to secure the VPS before using it as a gateway.
08
Frequently asked questions
Can WireGuard be installed on an LXC VPS?
It depends on the host: WireGuard runs in the kernel, which the container shares with the host machine. That kernel must provide WireGuard and the container must be able to create the interface. On our Ryzen and Intel VPS, that is the case.
Which port should be opened for WireGuard?
The port set by ListenPort in the server configuration, in UDP. By convention, 51820.
Does a VPN on a VPS make you anonymous?
No. It encrypts the connection and routes it out through the VPS address, but the VPS is rented in your name: it is a security and access tool, not an anonymity one.
How many devices on a WireGuard VPN?
As many as you want: each device has its key pair, its address in the private network and its [Peer] block on the server. The smallest VPS is enough for personal or family use.