Blog

Cara Setup VPN WireGuard di Ubuntu VPS

19 Sep 2025

Mengapa WireGuard?

WireGuard adalah protokol VPN modern yang lebih cepat, lebih simpel, dan lebih aman dibanding OpenVPN atau IPSec. Hanya ~4000 baris kode vs ~100000 OpenVPN.

Langkah 1: Install WireGuard

apt install wireguard -y

Langkah 2: Generate Keys

wg genkey | tee server_private.key | wg pubkey > server_public.key\nwg genkey | tee client_private.key | wg pubkey > client_public.key

Langkah 3: Konfigurasi Server

# /etc/wireguard/wg0.conf\n[Interface]\nAddress = 10.0.0.1/24\nListenPort = 51820\nPrivateKey = SERVER_PRIVATE_KEY\n\n[Peer]\nPublicKey = CLIENT_PUBLIC_KEY\nAllowedIPs = 10.0.0.2/32

Langkah 4: Konfigurasi Client

[Interface]\nPrivateKey = CLIENT_PRIVATE_KEY\nAddress = 10.0.0.2/24\nDNS = 1.1.1.1\n\n[Peer]\nPublicKey = SERVER_PUBLIC_KEY\nEndpoint = VPS_IP:51820\nAllowedIPs = 0.0.0.0/0

Langkah 5: Start & Enable

systemctl enable wg-quick@wg0\nsystemctl start wg-quick@wg0

Kesimpulan

WireGuard siap digunakan! Koneksi VPN yang cepat dengan latency minimal.

Semua Artikel