I want a Point to Site topology but since the "client" and "server" hosts are both in their own NAT networks I need to rely on a third host in a Hub and Spoke topology.
Host A (hub)
[Interface]
PrivateKey =
Address = 10.201.50.1/32
ListenPort = 51820
PreUp = sysctl -w net.ipv4.ip_forward=1
[Peer]
PublicKey =
AllowedIPs = 10.201.50.2/32
[Peer]
PublicKey =
AllowedIPs = 10.201.50.3/32
Host B (server)
[Interface]
PrivateKey =
Address = 10.201.50.2/32
PreUp = sysctl -w net.ipv4.ip_forward=1
PreUp = iptables -t mangle -A PREROUTING -i %i -j MARK --set-mark 0x40
PreUp = iptables -t nat -A POSTROUTING ! -o %i -m mark --mark 0x40 -j MASQUERADE
PostDown = iptables -t mangle -D PREROUTING -i %i -j MARK --set-mark 0x40
PostDown = iptables -t nat -A POSTROUTING ! -o %i -m mark --mark 0x40 -j MASQUERADE
[Peer]
PublicKey =
Endpoint = 198.230.220.45:51820
AllowedIPs = 10.201.50.0/24
PersistentKeepalive = 15
Host C (client)
[Interface]
PrivateKey =
Address = 10.201.50.3/32
[Peer]
PublicKey =
Endpoint = 198.230.220.45:51820
AllowedIPs = 10.201.50.0/24, 10.0.0.0/24
Both peers connect fine to the hub.
interface: wg0
public key:
private key: (hidden)
listening port: 51820
peer:
endpoint: :63882
allowed ips: 10.201.50.3/32
latest handshake: 35 seconds ago
transfer: 213.07 KiB received, 15.93 KiB sent
peer:
endpoint: :33868
allowed ips: 10.201.50.2/32
latest handshake: 1 minute, 6 seconds ago
transfer: 7.19 KiB received, 5.12 KiB sent
I can ping Host B from Host C fine which is good, but any other connection fails. For example, I can't ssh into Host B, it just hangs. I can't curl a web server running on Host B on port 80, it also hangs. No firewall is running on Host B as far as I'm aware. The other hosts in the Host B network aren't reachable at all.
Appreciate your help. Cheers