PeerA – 1.1.1.1
wg genkey > privatekey
wg pubkey < privatekey > publickey
ip link add dev wg0 type wireguard
ip address add dev wg0 192.168.2.1/24
ip address add dev wg0 192.168.2.1 peer 192.168.2.2
wg set wg0 listen-port 51820 private-key privatekey peer [PEER_PUBLIC_KEY] allowed-ips 192.168.88.0/24 endpoint 2.2.2.2:8172
ip link set up dev wg0
wg
PeerA – 2.2.2.2
wg genkey > privatekey
wg pubkey < privatekey > publickey
ip link add dev wg0 type wireguard
ip address add dev wg0 192.168.2.1/24
ip address add dev wg0 192.168.2.1 peer 192.168.2.2
wg set wg0 listen-port 51820 private-key privatekey peer [PEER_PUBLIC_KEY] allowed-ips 192.168.88.0/24 endpoint 1.1.1.1:8172
ip link set up dev wg0
wg
WORKING CONFIGS – Config file (/etc/wireguard/demo.conf)
Server1 – PUB_KEY – QVECuXHEgnAkhpGRWiEHHQaMsQl4dy56lZVb0Gmb8mk=
[Interface]
PrivateKey = aBKs+1oplpv03XmMG8qYs4i4sa77Pdobhk6Y2tjZKGo=
Address = 192.168.1.1/24
listenport = 51820
[Peer]
PublicKey = 4S3I92WrdDbmA2vIG9EDha01wWl73mncxEUWeBjd51g=
AllowedIPs = 192.168.1.0/24
Endpoint = 10.10.10.16:51820
PersistentKeepalive = 25
Server2 – PUB_KEY – 4S3I92WrdDbmA2vIG9EDha01wWl73mncxEUWeBjd51g=
[Interface]
PrivateKey = gJicBGf5f7CF4jtYVRZTHZqknFyQ5zJFKSwGcr1MbVI=
Address = 192.168.1.2/24
ListenPort = 51820
[Peer]
PublicKey = QVECuXHEgnAkhpGRWiEHHQaMsQl4dy56lZVb0Gmb8mk=
AllowedIPs = 192.168.1.0/24
Endpoint = 10.10.10.38:51820
PersistentKeepalive = 25