Installation:

sudo apt install wireguard

Generate public key and private key on server and peer:

wg genkey | sudo tee /etc/wireguard/private.key
sudo chmod go= /etc/wireguard/private.key
sudo cat /etc/wireguard/private.key | wg pubkey | sudo tee /etc/wireguard/public.key

Server

[Interface]
PrivateKey = <server-private-key>
Address = 10.10.0.1/24
ListenPort = 51820
SaveConfig = true

Peer

[Interface]
PrivateKey = <client-private-key>
Address = 10.10.0.2/24

[Peer]
PublicKey = <server-public-key>
AllowedIPs = 10.10.0.0/24
Endpoint = <server-ip-address>:51820

AllowedIPs will route traffic to IP/network via this peer


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *