Skip to content

Instantly share code, notes, and snippets.

@henri
Last active July 10, 2024 03:24
Show Gist options
  • Save henri/befaeb7230fd67c8333b7ba3391b7afb to your computer and use it in GitHub Desktop.
Save henri/befaeb7230fd67c8333b7ba3391b7afb to your computer and use it in GitHub Desktop.
wiregaurd cheatsheet
# basic status information
wg show
# enable wiregaurd unit (interface wg0) with systemctl
sudo systemctl enable --now wg-quick@wg0
# disable wiregaurd unit (interface wg0) with systemctl
sudo systemctl disable --now wg-quick@wg0
# bring up wireguard (interface wg0)
wg-quick up wg0
# take down wireguard (interface wg0)
wg-quick down wg0
# reload wireguard (interface wg0) - assumes it was loaded with systemd
systemctl reload wg-quick@wg0
# keep alive option for peer (25 seconds) - this is talkative
PersistentKeepalive = 25
# if you are using a preshared key (12345 is the key - you will want to pick one your self)
PresharedKey = 12345
# generate a randomish preshared key (two approaches)
openssl rand -base64 32
wg genpsk
# generate wg key pair
wg genkey | tee privatekey | wg pubkey > publickey
# -- handy links -- #
# https://www.wireguardconfig.com
# https://www.wireguard.com/quickstart/#quick-start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment