1

enter image description here

Hi, what i'm trying to do is explained as follows:

I need to retrieve some JSON data from the Arduino (192.168.1.101) making an HTTP request to 80.X.X.X or to the associated DDNS.

First, i have a VPS linux Ubuntu server publicly exposed on the internet with the ip of 80.X.X.X on which i have installed OpenVPN Server.

The Arduino is connected to a 4g LTE Router, but since i was unable to configure a site-to-site vpn with ipsec, i connected a Raspberry Pi with an OpenVPN Client that connects to the VPS.

Now to retrive these data from the Arduino i need to forward all the HTTP requests made on port 8080 on the VPS to the Arduino (port 80) by: VPS eth0 -> tun0, then on the Rasp: tun0 -> 192.168.1.101

I've enabled forwarding in both linux systems, but the problem is that i need some help configuring iptables rules, i would greatly appreciate any help :)

Edit: To make some debugging i connected my home pc to the OpenVPN Server getting the host 10.8.0.3, then i downloaded Xampp to run a Web server and using these policies on the VPS i succesfully made an HTTP request for the sample xampp dashboard

-A PREROUTING -i eth0 -p tcp -m tcp --dport 8080 -j DNAT --to-destination 10.8.0.3 
-A POSTROUTING -s 10.0.0.0/8 -o eth0 -j MASQUERADE

Now i dont know how to forward all the http requests to 192.168.1.101 on the Raspberry's LAN and then send back the response :( This is what I have tried so far

-A PREROUTING -i tun0 -p tcp --dport 8080 -j DNAT --to-destination 192.168.1.101:80
-A POSTROUTING -s 192.168.1.101 -o tun0 -j MASQUERADE

closed as off-topic by Jeff Schaller Jun 18 at 18:27

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Jeff Schaller
If this question can be reworded to fit the rules in the help center, please edit the question.