0

I've recently installed PiVPN on a newly created Pi system and I am able to connect to it ok from a remote client that I created. The problem is that although I'm able to access the node where my VPN server is installed (using SSH and ping) from my client, I'm unable to access any of the other nodes on my network (even by using IP addresses) or the internet. It looks like a routing problem but I don't know how to fix it.

Technical info:

  • Home network subnet: 192.168.100.0/24
  • Broadband router: 192.168.100.79
  • RPI system: 192.168.100.7
  • VPN subnet: 10.8.0.0/24

Please can someone advise how to fix this problem?

0

This excellent post by Stavros Korokithakis should help, specifically:

Accessing your home LAN

To actually access the server’s LAN, you’ll need to make a slight modification to the configuration. On the server’s config file [/etc/wireguard/wg0.conf], at the end of the the [Interface] section, add these two lines:

PostUp   = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE

This assumes that your LAN interface is called eth0. If it isn’t, change the lines above to the actual name.

On the client, add your LAN’s subnet under AllowedIPs. For example, if your subnet is 192.168.1.x, change AllowedIPs to look like this:

AllowedIPs = 192.168.2.0/24, 192.168.1.0/24

Therefore for your configuration, the client's AllowedIPs would be:

  • AllowedIPs = 10.8.0.0/24, 192.168.100.0/24

or you could forward all traffic from your client over the Wireguard tunnel with:

  • AllowedIPs = 0.0.0.0/0, ::0/0

And you'll also need to enable IP Forwarding if you haven't already

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.