Skip to content

Instantly share code, notes, and snippets.

@dragonly
Last active November 18, 2021 06:03
Show Gist options
  • Save dragonly/49fba22258b450302defd78a17ae9036 to your computer and use it in GitHub Desktop.
Save dragonly/49fba22258b450302defd78a17ae9036 to your computer and use it in GitHub Desktop.
wireguard setup
[Interface]
PrivateKey = x
Address = 192.168.2.5/24
ListenPort = 21841
[Peer]
PublicKey = x
Endpoint = $public_ip:51820
AllowedIPs = 192.168.2.0/24
[Interface]
PrivateKey = x
Address = 192.168.2.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 -j 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 = x
AllowedIPs = 192.168.2.2/32
[Peer]
PublicKey = x
AllowedIPs = 192.168.2.3/32
[Peer]
PublicKey = x
AllowedIPs = 192.168.2.4/32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment