Learn how to set up your own VPN using WireGuard on a VPS — step-by-step! Perfect for bug bounty hunters, privacy advocates, and cybersecurity beginners.

Sample WireGuard VPN Configuration Files

WireGuard VPN Server Configuration

The following is a sample WireGuard VPN server configuration file. For it to work, you need to replace the following value:

  • Replace PrivateKey with your own WireGuard VPN server’s private key
  • Replace PublicKey with your WireGuard VPN client’s public key
[Interface]
PrivateKey = SERVER_PRIVATE_KEY
Address = 10.0.0.1/24
ListenPort = 51820
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 0j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE

[Peer]
PublicKey = CLIENT_PUBLIC_KEY
AllowedIPs = 10.0.0.2/32

WireGuard VPN Client Configuration

The following is a sample WireGuard VPN client configuration file. For it to work, you need to replace the following value:

  • Replace PrivateKey with your own WireGuard VPN client’s private key
  • Replace PublicKey with your WireGuard VPN server’s public key
[Interface]
PrivateKey = CLIENT_PRIVATE_KEY
Address = 10.0.0.2/24
DNS = 1.1.1.1, 1.0.0.1

[Peer]
PublicKey = SERVER_PUBLIC_KEY
Endpoint = YOUR_DROPLET_IPV4_ADDRESS:51820
AllowedIPs = 0.0.0.0/0, ::/0
PersistentKeepalive = 25

Back to How to Set Up Your Own WireGuard VPN on a VPS (Beginner-Friendly Tutorial)


One Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.