wireguard
Сервер
apt install wireguard
man wg | grep Interface] -A 8 > wg0.conf
man wg | grep tee > gen_key.sh
wg genkey > /etc/wireguard/privatekey
cat /etc/wireguard/privatekey | wg pubkey > /etc/wireguard/publickey
--or--
wg genkey | tee /etc/wireguard/privatekey | wg pubkey | tee /etc/wireguard/publickey
wg genpsk > PSK
vi /etc/wireguard/wg0.conf
[Interface]
Address = 10.1.30.1/24, 2001:db8:1001:30::1/64
ListenPort = 51820
privatekey = <Server private key>
[Peer]
publickey = <Client public key>
allowedips = 10.1.30.0/24, 2001:db8:1001:30::0/64
presharedkey = < PSK ключ >
systemctl enable wg-quick@wg0
systemctl start wg-quick@wg0
Клиент
apt install wireguard resolvconf
wg genkey > /etc/wireguard/privatekey
cat /etc/wireguard/privatekey | wg pubkey > /etc/wireguard/publickey
--or--
wg genkey | tee /etc/wireguard/privatekey | wg pubkey | tee /etc/wireguard/publickey
vi /etc/wireguard/wg0.conf
[Interface]
address = 10.1.30.2/24, 2001:db8:1001:30::2/64
privatekey = <Client private key>
DNS = 10.1.10.10
[Peer]
publickey = <Server public key>
endpoint = 1.1.1.10:51820
Allowedips = 10.1.10.0/24, 10.1.20.0/24, 2001:db8:1001:10::0/64, 2001:db8:1001:20::0/64
presharedkey = < PSK ключ >
systemctl enable wg-quick@wg0
systemctl start wg-quick@wg0