I was trying to set up remote access to the LAN of an OpenVPN client, by configuring the OpenVPN client as a gateway. There are plenty guides online on how to do this, such as this one. In my setup, I was using a Netgear router, with a Raspberry Pi connected to it acting as the OpenVPN client and gateway for the LAN. I followed the setup carefully, but was frustrated to find it didn't work. The VPN worked fine: I could access the Raspberry Pi remotely, both on its VPN IP and its LAN IP addresses. Still, I could not gain access to the LAN it was connected to, even though I had set up a static route in the router to send all VPN traffic to the Raspberry Pi.
After breaking my head over this for a long time and getting very frustrated, I finally figured out what was going on. I needed to enable IP forwarding on the Raspberry Pi! To do this in such a way it is configured correctly at boot, uncomment the following line in /etc/sysctl.conf:
net.ipv4.ip_forward=1
That's it! After that, my setup worked beautifully. Hopefully this will save someone else some time and frustration. :-)
Leave a Comment