How do I set up a WireGuard VPN on a VPS?
Install WireGuard on your VPS, generate a key pair, and configure the server and client with a simple config file. Then start the interface and test the connection.
This guide will help you set up your own WireGuard VPN server on a VPS, giving you secure and fast encrypted tunneling. You'll have full control over your VPN, with no logs and no third-party dependencies.
Prerequisites: a VPS with a public IP address (any MurmurHost VPS plan works, starting at $8/mo), root or sudo access, and a local client (Windows, macOS, Linux, or mobile).
- 1
Install WireGuard
SSH into your VPS and install WireGuard. On Ubuntu/Debian:sudo apt update && sudo apt install wireguard. On CentOS/RHEL:sudo yum install epel-release && sudo yum install wireguard-tools. - 2
Generate server keys
Generate a private and public key pair for the server:wg genkey | tee server_private.key | wg pubkey > server_public.key. Keep the private key secret. - 3
Create server config
Create/etc/wireguard/wg0.confwith the following content, replacingServerPrivateKeywith your server's private key andServerIPwith your VPS's public IP:[Interface] Address = 10.0.0.1/24 SaveConfig = true ListenPort = 51820 PrivateKey = ServerPrivateKey [Peer] PublicKey = ClientPublicKey AllowedIPs = 10.0.0.2/32
- 4
Enable IP forwarding
Enable IP forwarding on the server:echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.conf && sudo sysctl -p. Also set up NAT with iptables if you want clients to access the internet:sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE(replace eth0 with your main interface). - 5
Start WireGuard
Start the WireGuard interface and enable it on boot:sudo systemctl start wg-quick@wg0andsudo systemctl enable wg-quick@wg0. - 6
Generate client keys and config
On your local machine, generate a client key pair:wg genkey | tee client_private.key | wg pubkey > client_public.key. Create a client config file (e.g.,client.conf) with:[Interface] PrivateKey = ClientPrivateKey Address = 10.0.0.2/24 DNS = 1.1.1.1 [Peer] PublicKey = ServerPublicKey Endpoint = ServerIP:51820 AllowedIPs = 0.0.0.0/0
- 7
Add client to server
On the server, add the client's public key to the config:sudo wg set wg0 peer ClientPublicKey allowed-ips 10.0.0.2/32. If you used the config file, restart WireGuard:sudo systemctl restart wg-quick@wg0. - 8
Test the connection
Import the client config into your WireGuard client app (or usewg-quick up client.confon Linux). Ping the server:ping 10.0.0.1. Then check your public IP to confirm traffic is routed through the VPN.
Make sure your VPS firewall allows UDP port 51820. MurmurHost includes DDoS protection, but you may still want to configure a firewall for extra security. Since MurmurHost is offshore and no-KYC, you can set up your VPN with complete privacy, paying with Monero or Bitcoin if you wish.
Frequently asked questions
What is the default port for WireGuard?+
Can I use WireGuard on a MurmurHost VPS?+
How do I make WireGuard start automatically on boot?+
sudo systemctl enable wg-quick@wg0. This will start the VPN interface every time your server boots.Is WireGuard faster than OpenVPN?+
Deploy your first offshore server in 60 seconds.
Anonymous signup. Bitcoin & Monero accepted. Provisioned across 8 jurisdictions.
No credit card required · 7-day money-back guarantee