Setup WireGuard Server
- Make sure the WireGuard module is loaded
sudo modprobe WireGuard
- Generate your public/private keys
sudo sh -c 'umask 077; \ mkdir -p /etc/wireguard; \ wg genkey | tee /etc/wireguard/privatekey-$(hostname -s); \ wg pubkey < /etc/wireguard/privatekey-$(hostname -s) > /etc/wireguard/publickey-$(hostname -s)'
- Add the WireGuard device
sudo ip link add dev wg0 type wireguard
- Setup your configuration file at
/etc/wireguard/wg0.conf
[Interface]
ListenPort = 51820
PrivateKey = VPN_SERVER_PRIVATE_KEY
[Peer]
PublicKey = PEER_1_PUBLIC_KEY
AllowedIPs = VPN_NETWORK_IP_FOR_PEER_1/32
[Peer]
PublicKey = PEER_2_PUBLIC_KEY
AllowedIPs = VPN_NETWORK_IP_FOR_PEER_2/32