Port forwarding using OpenVPN client

Business solution to host your own OpenVPN server with web management interface and bundled clients.
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

ViewableGravy
OpenVpn Newbie
Posts: 2
Joined: Wed Jun 22, 2022 3:54 pm

Re: Port forwarding using OpenVPN client

Post by ViewableGravy » Wed Jun 22, 2022 3:55 pm

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

User avatar
openvpn_inc
OpenVPN Inc.
Posts: 686
Joined: Tue Feb 16, 2021 10:41 am

Re: Port forwarding using OpenVPN client

Post by openvpn_inc » Thu Jun 23, 2022 2:44 am

Image OpenVPN Inc.
Answers provided by OpenVPN Inc. staff members here are provided on a voluntary best-effort basis, and no rights can be claimed on the basis of answers posted in this public forum. If you wish to get official support from OpenVPN Inc. please use the official support ticket system: https://openvpn.net/support

ViewableGravy
OpenVpn Newbie
Posts: 2
Joined: Wed Jun 22, 2022 3:54 pm

Re: Port forwarding using OpenVPN client

Post by ViewableGravy » Thu Jun 23, 2022 9:27 am

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 :)

User avatar
openvpn_inc
OpenVPN Inc.
Posts: 686
Joined: Tue Feb 16, 2021 10:41 am

Re: Port forwarding using OpenVPN client

Post by openvpn_inc » Thu Jun 23, 2022 9:43 pm

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
Image OpenVPN Inc.
Answers provided by OpenVPN Inc. staff members here are provided on a voluntary best-effort basis, and no rights can be claimed on the basis of answers posted in this public forum. If you wish to get official support from OpenVPN Inc. please use the official support ticket system: https://openvpn.net/support

Post Reply