WireGuard
Keygen
Make private and public keys for client and for server (run twice).
Fish:
wg genkey | read F && echo $F && echo $F | wg pubkey
Bash:
wg genkey | while read F; do echo $F && echo $F | wg pubkey; done
Server
[Interface]
PrivateKey = <server: wg genkey>
MTU = 1340
ListenPort = <server port>
Address = 172.17.1.1/24
PostUp = iptables -A FORWARD -o vpn -i enp1s0 -j ACCEPT && iptables -A FORWARD -i vpn -o enp1s0 -j ACCEPT
PreDown = iptables -D FORWARD -o vpn -i enp1s0 -j ACCEPT && iptables -D FORWARD -i vpn -o enp1s0 -j ACCEPT
[Peer]
PublicKey = <client: wg pubkey>
AllowedIPs = 172.17.1.10/32
PersistentKeepalive = 300
Client
[Interface]
PrivateKey = <client: wg genkey>
MTU = 1340
Address = 172.17.1.10/24
DNS = 172.17.1.1
[Peer]
PublicKey = <server: wg pubkey>
AllowedIPs = 0.0.0.0/0,::0/0
Endpoint = <server IP>:<serer port>