Skip to content

Instantly share code, notes, and snippets.

@gallegogt
Last active May 27, 2021 20:51
Show Gist options
  • Save gallegogt/47a0bbdb71539031091ec567dd7fb3b2 to your computer and use it in GitHub Desktop.
Save gallegogt/47a0bbdb71539031091ec567dd7fb3b2 to your computer and use it in GitHub Desktop.
VPN WireGuard Server Config
[Interface]
Address = 10.5.0.1/24
PrivateKey = <SERVER_PRIVATE_KEY>
ListenPort = 54321
SaveConfig = false
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; iptables -A INPUT -s 10.5.0.0/24 -p udp -m udp --dport 53 -m conntrack --ctstate NEW -j ACCEPT
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; iptables -D INPUT -s 10.5.0.0/24 -p udp -m udp --dport 53 -m conntrack --ctstate NEW -j ACCEPT
# C-1
[Peer]
PublicKey = <CLIENT_PUBLIC_KEY>
PresharedKey = <CLIENT-SERVER PRESHARED KEY>
AllowedIPs = 10.5.0.2/32
# C-N
[Peer]
PublicKey = <CLIENT_N_PUBLIC_KEY>
PresharedKey = <CLIENT_N-SERVER PRESHARED KEY>
AllowedIPs = 10.5.0.3/32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment