Skip to content

Instantly share code, notes, and snippets.

@cbluth cbluth/wg0-diagram.md Secret
Last active Aug 7, 2018

Embed
What would you like to do?
Wireguard Setup
# PEER 1
[Interface]
Address = 172.16.1.1/24
SaveConfig = true
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o enp0s31f6 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o enp0s31f6 -j MASQUERADE
ListenPort = 51820
PrivateKey = <redacted>
# PEER 2
[Peer]
PublicKey = k2pYq8YG1J6DzxE7PdQ1EjidiZayOTbAH7o85tNtORk=
AllowedIPs = 192.168.2.0/24, 172.16.1.2/32
Endpoint = peer2.example.com:51820
PersistentKeepalive = 20
# PEER 3
[Peer]
PublicKey = Y4BSlYdgtit7+Tl+3qlgCs5W3HODGfnC/CDQ8mjbOy8=
AllowedIPs = 192.168.3.0/24, 172.16.1.3/32
Endpoint = peer3.example.com:51820
PersistentKeepalive = 20
# PEER 2
[Interface]
Address = 172.16.1.2/24
SaveConfig = true
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o enp0s31f6 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o enp0s31f6 -j MASQUERADE
ListenPort = 51820
PrivateKey = <redacted>
# PEER 1
[Peer]
PublicKey = OuRuavuj4ePwbOco29e1lBy+TsM5y+PXqO8h87BapjI=
AllowedIPs = 192.168.1.0/24, 172.16.1.1/32
Endpoint = peer1.example.com:51820
PersistentKeepalive = 20
# PEER 3
[Peer]
PublicKey = Y4BSlYdgtit7+Tl+3qlgCs5W3HODGfnC/CDQ8mjbOy8=
AllowedIPs = 192.168.3.0/24, 172.16.1.3/32
Endpoint = peer3.example.com:51820
PersistentKeepalive = 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.