I have 3 VPS servers, with public IPs, let's call them wireguard1, wireguard2 and wireguard3.
I have successfully managed to connect wireguard1 and wireguard2 using the following DigitalOcean tutorial. I have then successfully managed to connect wireguard1 and wireguard3.
The configuration files look like this :
On wireguard1:
[Interface]
Address = 10.0.0.1/24
SaveConfig = true
ListenPort = 5555
PrivateKey = <wireguard1 private key>
[Peer]
PublicKey = <wireguard2 public key>
AllowedIPs = 10.0.0.2/32
Endpoint = <wireguard2 public ip address>:5555
[Peer]
PublicKey = <wireguard3 public key>
AllowedIPs = 10.0.0.3/32
Endpoint = <wireguard3 public ip address>:5555
On wireguard2:
[Interface]
Address = 10.0.0.2/24
SaveConfig = true
ListenPort = 5555
PrivateKey = <wireguard2 private key>
[Peer]
PublicKey = <wireguard1 public key>
AllowedIPs = 10.0.0.0/24
Endpoint = <wireguard1 public ip address>:5555
On wireguard3:
[Interface]
Address = 10.0.0.3/24
SaveConfig = true
ListenPort = 5555
PrivateKey = <wireguard3 private key>
[Peer]
PublicKey = <wireguard1 public key>
AllowedIPs = 10.0.0.0/24
Endpoint = <wireguard1 public ip address>:5555
I can ping wireguard1 (10.0.0.1) from wireguard2 (10.0.0.2) and vice-versa, so that works fine. I can ping wireguard1 (10.0.0.1) from wireguard3 (10.0.0.3) and vice-versa, so that works fine.
I can however not ping wireguard2 (10.0.0.2) from wireguard3 (10.0.0.3) or vice-versa. I could indeed at a [Peer]
section in wireguard2 referencing wireguard3, but I would like to find a solution where all trafic goes through wireguard1.
I thought that setting the AllowedIP to 10.0.0.0/24 would do the trick, but it does not seem to work.
Has anyone a working solution?