Difference between revisions of "Wireguard point-to-point"
Jump to navigation
Jump to search
(Created page with "``` 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/wi...") |
|||
Line 7: | Line 7: | ||
wg genkey | tee /etc/wireguard/privatekey | wg pubkey > /etc/wireguard/publickey | wg genkey | tee /etc/wireguard/privatekey | wg pubkey > /etc/wireguard/publickey | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
``` | ``` | ||
+ | Host A /etc/wireguard/wg0.conf | ||
``` | ``` | ||
[Interface] | [Interface] | ||
Line 30: | Line 24: | ||
``` | ``` | ||
+ | Host B /etc/wireguard/wg0.conf | ||
``` | ``` | ||
[Interface] | [Interface] |
Latest revision as of 09:33, 27 July 2024
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
Host A /etc/wireguard/wg0.conf
[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
Host B /etc/wireguard/wg0.conf
[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