I'm new to Linux. I have set an OpenVPN server on one of my Raspberry Pi 4 running Raspbian system (PiVPN script). Then I set client OpenVPN on my other Raspberry Pi 4 (the first one server is at my parents' house abroad). I can easily connect both of them or my laptop or Android Smartphone and it all works fine.

Recently I have set the client one as a WiFi hotspot so I can connect many devices and get IP from the Raspberry server (get around the geographical restrictions). Once I start the VPN connection I lose the internet connection over the WiFi (client Raspberry Pi). Yesterday, I got the USB-RJ45 Ethernet adaptor but over this, I get the same problem.

I think I need to change routing and forwarding in the configuration.
Can anyone help me with it, please?

sudo iptables -F
sudo iptables -t nat -F
sudo iptables -X
sudo iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

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.