Skip to content

Instantly share code, notes, and snippets.

@superstes
Last active December 22, 2023 20:00
Show Gist options
  • Save superstes/ffee4af63fd2303bc2e1794312ef9e6b to your computer and use it in GitHub Desktop.
Save superstes/ffee4af63fd2303bc2e1794312ef9e6b to your computer and use it in GitHub Desktop.
Basic WireGuard Client/Server Config
### BASIC ###
GEN KEYS: wg genkey | tee privatekey | wg pubkey > publickey
ADD CONFIG: /etc/wireguard/<CONFIG>.conf
ADD SERVICE: systemctl start wg-quick@<CONFIG>.service
EN SERVICE: systemctl enable wg-quick@<CONFIG>.service
### SERVER ###
[Interface]
Address = 10.0.1.1/24
ListenPort = <SRV-PORT>
PrivateKey = <SRV-KEY>
MTU = 1400
[Peer]
# <COMMENT>
PublicKey = <CLI-PUB>
#PresharedKey = <PSK>
PersistentKeepalive = 3
AllowedIPs = 10.0.1.10/32
### CLIENT ###
[Interface]
Address = 10.0.1.10/24
PrivateKey = <CLI-KEY>
MTU = 1400
# make sure dynamic endpoints reconnect
PostUp = /bin/bash -c "while sleep 30; do ping -c4 10.0.1.1 > /dev/null 2>&1"
[Peer]
# <COMMENT>
Endpoint = <SRV-IP>:<SRV-PORT>
PublicKey = <SRV-PUB>
#PresharedKey = <PSK>
PersistentKeepalive = 3
AllowedIPs = 10.0.1.1/32, 10.0.0.0/24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment