WG-EASY VPN Installation Guide (Docker Run)

📌 Overview

This guide explains how to install and run wg-easy (WireGuard VPN) on a VPS using Docker.


⚙️ 1. Update System

apt update && apt upgrade -y

🐳 2. Install Docker

apt install -y docker.io docker-compose
systemctl enable docker
systemctl start docker

Check Docker:

docker --version

🔥 3. Open Required Ports

ufw allow 51820/udp
ufw allow 51821/tcp
ufw enable

🚀 4. Run wg-easy

docker run -d \
  --name=wg-easy \
  -e WG_HOST=193.124.57.125 \
  -e PASSWORD_HASH='$2a$12$TXjvDufTG5P4ef6k7M0F..3z7NekUPoHnaNyHnY9XHrSIlxG5nPyO' \
  -e WG_DEFAULT_DNS=1.1.1.1,1.0.0.1 \
  -v /etc/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

📊 5. Check Logs

docker logs -f wg-easy

Expected output:

Server Listening on http://0.0.0.0:51821

🌐 6. Access Web Interface

Open in browser:

http://193.124.57.125:51821
  • Login password = your original password (not the hash)

⚠️ 7. Fix No Internet Issue

If VPN connects but has no internet:

sysctl -w net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

💡 Notes

  • Default DNS: Cloudflare (1.1.1.1)
  • Make sure your VPS provider allows UDP traffic
  • Use strong password

Done

Your WireGuard VPN server is now ready 🎉

S
Description
No description provided
Readme
66 KiB