I've setup an OpenVPN server on my Raspberry pi at home. However, I do not have a static public IP address. For that reason, I made an OpenVPN tunnel on a custom public VPS server with another OpenVPN server. At least now I can ssh on my raspberry pi anywhere even if my public IP changes (through the vpn tunnel).
I'm trying to use iptables to forward the raspberry pi OpenVPN server tcp port 1195 on that specific vpn tunnel (10.8.0.3).
sudo iptables -A FORWARD -p tcp --dport 1121 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
sudo iptables -t nat -A PREROUTING -i ens3 -p tcp --dport 1121 -j DNAT --to-dest 10.8.0.3:1121
sudo iptables -t nat -A POSTROUTING -d 10.8.0.3 -j MASQUERADE
I can connect to my raspberry pi openvpn server (trough my vps on tcp port 1121) but I do not have any internet access and I don't know why. My raspberry pi receives requests and send it back to my vps (I checked with tcpdump) but my vps seems to be unable to send it back to the original client (my pc).
Do you know a better way? A hint on where to look ? How to fix the problem ?