As explained here you should be able to use iptables to forward traffic from a port, in one interface, to some other IP that may be on other interface. Just have in mind that you may need to configure your OpenVPN server to always issue your local server with the same IP, which you can find out how to do here.
In essence,
- make sure that forwarding is allowed on your server
sudo sysctl net.ipv4.ip_forward=1
- Assuming that your VPN IP is
10.0.0.1
and that your server external interface is eth0
, forward connections from port 80 externally to your VPN IP and allow it to answer:
iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 80 -j DNAT --to-destination 10.0.0.1:80
iptables -A FORWARD -p tcp -d 10.0.0.1 --dport 80 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
To debug connection issues tcpdump
is your friend, as in:
# Print all packets on port 80 that pass through the eth0 interface
sudo tcpdump -ni eth0 port 80
Please note that as a general recommendation you should always use encryption, so much that by default the 443 port would also be required to enable HTTPS.
firewalld
, for example, as well as you could also be talking about unix distributions which would hardly haveiptables
available. Your OpenVPN setup may also interfere with whether my answer will work or not, so please let me know if it works or not!