Back to all guides
Security & Networking

How to Set Up a WireGuard VPN Server with Web UI (Ubuntu 24.04)

4 read2026-08-31

WireGuard is an extremely fast, modern, and secure VPN protocol built directly into the Linux kernel. By pairing WireGuard with WG-Easy, you get a clean web dashboard to create, manage, and connect VPN clients (PC, Mac, iOS, Android) in seconds via QR codes.

Network Tip: A high-speed VPN requires low ping and unthrottled bandwidth. Our Prepaid KVM Root Servers feature multi-gigabit uplinks through two autonomous systems (AS215136 & AS211066) in Germany and the Netherlands, guaranteeing lightning-fast VPN throughput.

1. Prerequisites & Docker Installation

Ensure Docker is installed and running on your Ubuntu 22.04 / 24.04 server:

bash
sudo apt update && sudo apt upgrade -y
sudo apt install -y curl docker.io docker-compose
sudo systemctl enable --now docker

2. Enable IP Forwarding

For your server to route VPN traffic to the internet, enable kernel packet forwarding:

bash
echo "net.ipv4.ip_forward=1" | sudo tee -a /etc/sysctl.d/99-wireguard.conf
echo "net.ipv4.conf.all.src_valid_mark=1" | sudo tee -a /etc/sysctl.d/99-wireguard.conf
sudo sysctl -p /etc/sysctl.d/99-wireguard.conf

3. Deploy WG-Easy with Docker

Create a directory for WireGuard data:

bash
mkdir -p ~/wireguard && cd ~/wireguard

Run the WG-Easy container (replace <YOUR-SERVER-IP> and YourAdminPassword):

bash
sudo docker run -d   --name=wg-easy   -e WG_HOST=<YOUR-SERVER-IP>   -e PASSWORD_HASH=$(docker run --rm ghcr.io/wg-easy/wg-easy wgpw 'YourAdminPassword')   -e PORT=51821   -e WG_PORT=51820   -v ~/.wireguard:/etc/wireguard   -p 51820:51820/udp   -p 51821:51821/tcp   --cap-add=NET_ADMIN   --cap-add=SYS_MODULE   --sysctl="net.ipv4.conf.all.src_valid_mark=1"   --sysctl="net.ipv4.ip_forward=1"   --restart unless-stopped   ghcr.io/wg-easy/wg-easy

4. Firewall Ports (UFW)

Allow the WireGuard VPN tunnel (UDP) and web management dashboard (TCP):

bash
sudo ufw allow 51820/udp
sudo ufw allow 51821/tcp

5. Access Web Dashboard & Connect Clients

  1. Open your browser at: http://<YOUR-SERVER-IP>:51821
  2. Log in with your password.
  3. Click New Client, enter a name (e.g. Smartphone or Laptop), and click Create.
  4. Scan the QR code with the official WireGuard app on your phone, or download the .conf file for your PC.
KVM Linux VPS

Looking for the right Linux VPS?

Put your project into practice right away: Our KVM VPS provide full root access, lightning-fast NVMe storage, and reliable KVM isolation. Flexible prepaid billing with no subscription and personal Discord support.

Full Root Access (SSH)
Datacenter NVMe SSD
4+ Tbps DDoS Protection
100% Prepaid (No Subscription)