
1. Install package
apt update
apt install wireguard -y2. Generate keys
wg genkey | tee /etc/wireguard/private.key
chmod go= /etc/wireguard/private.key
cat /etc/wireguard/private.key | wg pubkey | tee /etc/wireguard/public.key3. Create config
cat <<EOF | tee /etc/wireguard/wg0.conf
[Interface]
PrivateKey = <private_key>
Address = 10.10.101.1/24
ListenPort = 443
[Peer]
PublicKey = <client_public_key>
AllowedIPs = 10.10.0.0/16, 192.168.100.0/24
#Endpoint = 203.0.113.1:51820
EOF4. Enable packet forwarding between interfaces
echo 'net.ipv4.ip_forward=1' > /etc/sysctl.d/60-netipv4_sysctl.conf
sysctl -w net.ipv4.ip_forward=15. Start up tunnel interface
wg-quick up wg0
wg show