Score:1

Cannot connect local peer to local peer over Wireguard

cn flag

I have online server with IP 1.2.3.4 and two local computers on different locations. computer A and computer B.

I have followed instructions how to setup Wireguard here: https://www.cyberciti.biz/faq/ubuntu-20-04-set-up-wireguard-vpn-server/

But computer A cannot ping or connect to computer B.

I think I think I need but do not know how to setup on online server to do that communication beetween local peers.

How to do that?

Local peers are mac and ubuntu desktop.

My setup: Server:

[Interface]
Address = 192.168.6.1/24
ListenPort = 41194
PrivateKey = <key>


[Peer]
PublicKey = <key>
AllowedIPs = 192.168.6.2/32
PersistentKeepalive = 15

[Peer]
PublicKey = <key>
AllowedIPs = 192.168.6.3/32
PersistentKeepalive = 15

Local Peer A:

[Interface]
PrivateKey = <key>
Address = 192.168.6.2/32

[Peer]
PublicKey = <key>
AllowedIPs = 192.168.6.1/32
Endpoint = 65.21.63.31:41194
PersistentKeepalive = 21

[Peer]
PublicKey = <key>
AllowedIPs = 192.168.6.3/32
PersistentKeepalive = 15

Local Peer B:

[Interface]
PrivateKey = <key>
Address = 192.168.6.3/32

[Peer]
PublicKey = <key>
AllowedIPs = 192.168.6.1/32
Endpoint = 65.21.63.31:41194
PersistentKeepalive = 21

[Peer]
PublicKey = <key>
AllowedIPs = 192.168.6.2/32
PersistentKeepalive = 15

Server can communicate with Peer A and Peer B but Peer A cannot with Peer B.

Score:0
cn flag

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
cn flag
both peers are local, only computer is online with static ip
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.