0

I'm trying to configure a VPN with Wireguard, but I'm having problems. The VPN works correctly with the server and the client inside the same network. However, anytime I connect my client to a different network, I lose connection from the server. My server is configured in a Raspberry Pi 3. Here is the wg0.conf:

[Interface]
Address = 10.8.0.1/24
SaveConfig = true
PostUp = iptables -t nat -I POSTROUTING -o wlan0 -j MASQUERADE
PreDown = iptables -t nat -D POSTROUTING -o wlan0 -j MASQUERADE
ListenPort = 51820
PrivateKey = XXXXX

[Peer]
PublicKey = PPPP
AllowedIPs = 10.8.0.2/32

My client is in a Windows 10. Here is the configuration:

[Interface]
PrivateKey = XXXXXX
ListenPort = 51820
Address = 10.8.0.2/24

[Peer]
PublicKey = PPPP
AllowedIPs = 10.8.0.0/24, 192.168.10.0/24
Endpoint = PUBLIC_IP:51820

I also opened the port in my router, but I'm not sure how can I check if it's open

Any advice is welcome. Thank you!

1
  • Did you open the port for UDP specifically? Install a packet capture tool (tcpdump, termshark, Wireshark) on both systems and check whether the server is receiving the packets that the client is sending. Commented Jan 7, 2023 at 10:57

1 Answer 1

0

In your server configuration you have:

AllowedIPs = 10.8.0.2/32

This means that only clients coming from 10.8.0.2/32 net range can connect. You should expand this accordingly to allow IPs from your other network.

1
  • That's not what AllowedIPs does. It puts restrictions on the peer's inner (tunneled) address, not the outer address. Commented Jan 7, 2023 at 10:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .