Page 1 of 1

Port forwarding using OpenVPN client

Posted: Sat Jun 16, 2018 12:04 pm
by kymy8888
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

Re: Port forwarding using OpenVPN client

Posted: Wed Jun 22, 2022 3:55 pm
by ViewableGravy
Hey, did you ever get this resolved?

I've been wanting to set this up but with limited knowledge am looking for a guide or tutorial to follow and haven't stumbled upon more than dead threads like this one

Re: Port forwarding using OpenVPN client

Posted: Thu Jun 23, 2022 2:44 am
by openvpn_inc

Re: Port forwarding using OpenVPN client

Posted: Thu Jun 23, 2022 9:27 am
by ViewableGravy
Hey rob0

Thanks heaps for this. Finding the right keywords is definitely the biggest part of setting up something you have no idea about ;)

All configured now :)

Re: Port forwarding using OpenVPN client

Posted: Thu Jun 23, 2022 9:43 pm
by openvpn_inc
Hi Gravy,

Yes, I wouldn't have thought of the term "DMZ" for this, either. But openvpn.net searches for DNAT and SNAT takes you right there. Google, not so lucky. You get a lot of misguided or irrelevant garbage.

My own motto is "RTFM before STFW". In the case of Access Server, the documentation is online at openvpn.net, not in a Friendly Manual. But limiting the search of the Fine Web to the proper site is the way to go.

Digging a bit further, Google search for "OpenVPN Access Server" port forwarding client got pretty close.

The thing is, so many "openvpn" searches find stuff about Community openvpn, which sure, that's more or less how it is done behind the scenes in Access Server. But the whole point of Access Server is that the hard part has been done for you!

regards, rob0