Skip to content

Instantly share code, notes, and snippets.

@tschaefer
Forked from mikoim/README.md
Last active June 9, 2019 17:34
Show Gist options
  • Save tschaefer/d161d385723ff0aea0c16d4b02df7a88 to your computer and use it in GitHub Desktop.
Save tschaefer/d161d385723ff0aea0c16d4b02df7a88 to your computer and use it in GitHub Desktop.
WireGuard example configuration for VPN

Server

iptables -A FORWARD -i wg0 -o YOUR_INTERFACE -s 10.200.200.0/24 -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -o YOUR_INTERFACE -s 10.200.200.0/24 -j MASQUERADE

Client

wg-quick up `pwd`/client.conf
wg-quick down `pwd`/client.conf

Issues

  • can't read wg-quick's resolve.conf due to insufficient permissions
[Interface]
Address = 10.200.200.2/24
PrivateKey = <client private key>
#DNS = 1.1.1.1
[Peer]
PublicKey = <server public key>
PresharedKey =
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = 123.123.123.123:51820
[NetDev]
Name = wg0
Kind = wireguard
[WireGuard]
ListenPort = 51820
PrivateKey = <server private key>
[WireGuardPeer]
PublicKey = <server public key>
PresharedKey =
AllowedIPs = 10.200.200.2/32
[Match]
Name = wg0
[Network]
Address = 10.200.200.1/32
[Route]
Gateway = 10.200.200.1
Destination = 10.200.200.0/24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment