Port forwarding using OpenVPN client

Post Reply
kymy8888
OpenVpn Newbie
Posts: 1
Joined: Sat Jun 16, 2018 12:00 pm

Port forwarding using OpenVPN client

Post by kymy8888 » Sat Jun 16, 2018 12:04 pm

Hello

I have a OpenVPN access server version 2.5 and a client configured with a site-to-site routing. Both client and server can communicate with each other by using the private IP addresses. On the client, there is an Apache server which listen on port 8081.

The goal is to be able to connect to the OpenVPN server public IP, and have it forward the connection to the client, so that the user can access the Apache server behind.

My current setup is:

Image

Code: Select all

sysctl -w net.ipv4.ip_forward=1

iptables -t nat -A PREROUTING -d 50.xxx.xxx.xxx -p tcp --dport 8081 -j DNAT --to-dest 192.168.2.86:8081

iptables -t nat -A POSTROUTING -d 192.168.2.86 -p tcp --dport 8081 -j SNAT --to-source 10.0.2.42
Is there something simple I'm doing incorrectly? Thank you

Post Reply