The tutorial you referenced looks like it's directing you toward a "hub and spoke" topology, where Peer A and Peer B don't connect directly to one another -- instead their connection is routed through your Server. If that's what you want to do, you should remove the second [Peer]
entry from both Peer A's and Peer B's config files, and change the AllowedIPs
setting of their first [Peer]
entry to this:
AllowedIPs = 192.168.6.0/24
You'll also need to make sure you enable packet forwarding on the Server. There are a few different ways to do this, but the simplest with WireGuard is just to add the following PreUp
command to the [Interface]
section of the Server's config file:
PreUp = sysctl -w net.ipv4.ip_forward=1
However, if what you want to do is connect Peer A to Peer B directly (ie "point to point"), you need to have a static public IP address for one of the peers. If that's the case, you'd keep that second [Peer]
entry in Peer A's and Peer B's config files; and add an Endpoint
setting to the second [Peer]
entry of one of their files, and a ListenPort
setting to the [Interface]
entry of the other.
For example, if Peer A is accessible to Peer B over the Internet (or some internal network) at 198.51.100.123, and has UDP port 51820 accessible to new connections from Peer B, change the second [Peer]
entry in Peer B's config file to this:
[Peer]
PublicKey = <key>
AllowedIPs = 192.168.6.2/32
Endpoint = 198.51.100.123:51820
PersistentKeepalive = 15
And change the [Interface]
entry in Peer A's config to this:
[Interface]
PrivateKey = <key>
Address = 192.168.6.2/32
ListenPort = 51820