1

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?

4

1 回答 1

0

我有一段时间遇到同样的问题。似乎您需要让所有对等方都拥有所有其他客户端的公钥才能正常工作。但是,我不确定它们是否都需要端点。对于您的配置,它看起来像这样:

在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

在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.1/32
Endpoint = <wireguard1 public ip address>:5555

[Peer]
PublicKey = <wireguard3 public key>
AllowedIPs = 10.0.0.3/32
Endpoint = <wireguard3 public ip address>:5555

在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.1/32
Endpoint = <wireguard1 public ip address>:5555

[Peer]
PublicKey = <wireguard2 public key>
AllowedIPs = 10.0.0.2/32
Endpoint = <wireguard2 public ip address>:5555
于 2019-06-27T00:44:28.820 回答