Wireguard point-to-point
Jump to navigation
Jump to search
sudo apt update sudo apt install wireguard sudo yum install epel-release sudo yum install wireguard-tools wg genkey | tee /etc/wireguard/privatekey | wg pubkey > /etc/wireguard/publickey wg genkey | tee /etc/wireguard/privatekey | wg pubkey > /etc/wireguard/publickey
[Interface] PrivateKey = <Host A private key> Address = 10.0.0.1/24 ListenPort = 51820 [Peer] PublicKey = <Host B public key> AllowedIPs = 10.0.0.2/32 Endpoint = <Host B public IP>:51820
[Interface] PrivateKey = <Host B private key> Address = 10.0.0.2/24 ListenPort = 51820 [Peer] PublicKey = <Host A public key> AllowedIPs = 10.0.0.1/32 Endpoint = <Host A public IP>:51820
echo "net.ipv4.ip_forward = 1" | sudo tee -a /etc/sysctl.conf sudo sysctl -p
sudo wg-quick up wg0
sudo wg show
sudo systemctl enable wg-quick@wg0
sudo journalctl -u wg-quick@wg0