Skip to content

Instantly share code, notes, and snippets.

@rudolfschmidt
Last active March 13, 2022 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rudolfschmidt/2866f8987cbae4f3d8ec36688880a1c8 to your computer and use it in GitHub Desktop.
Save rudolfschmidt/2866f8987cbae4f3d8ec36688880a1c8 to your computer and use it in GitHub Desktop.
apt-get update && apt-get upgrade
apt-get install wireguard
vim /etc/sysctl.conf
uncoment net.ipv4.ip_forward=1
sudo sysctl -p to verify
apt-get install wireguard
cd /etc/wireguard
umask 077; wg genkey | tee privatekey | wg pubkey > publickey
vim /etc/wireguard/wg0.conf
server
-------------------
[Interface]
PrivateKey = <generated privatekey>
Address = 192.168.69.1/24
ListenPort = 51820
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -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
[Peer]
PublicKey=<The Public Key of the Debian Client>
AllowedIPs=192.168.69.2
PersistentKeepalive=25
systemctl enable wg-quick@wg0.service
or
wg-quick up wg0
client
-------------------
apt-get update && apt-get upgrade
apt-get install wireguard
vim /etc/sysctl.conf
uncoment net.ipv4.ip_forward=1
sudo sysctl -p to verify
apt-get install wireguard
cd /etc/wireguard
umask 077; wg genkey | tee privatekey | wg pubkey > publickey
vim /etc/wireguard/wg0.conf
[Interface]
PrivateKey = <Generated Local PrivateKey>
Address=192.168.69.2/24
[Peer]
PublicKey=<Public Key From Server>
Endpoint=<Public IP of VPN Server>:51820
AllowedIPs = 0.0.0.0/0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment