openvpn-client icon indicating copy to clipboard operation
openvpn-client copied to clipboard

Connecting to remote server through openvpn-client

Open wolph opened this issue 5 years ago • 4 comments

Perhaps this is something that's already supported somehow or I'm just not getting how to configure it correctly... but I can't find a way to connect to a remote server through the VPN client.

The "regular" solution for my problem:

  1. connect to the VPN server from my machine to get an IP in the 172.18.x.x range
  2. reach the webserver in the 192.168.10.x range by hostname

Since I don't want to keep connecting/disconnecting to the VPN all the time just for that one service, I'm trying to set up a reverse proxy from my local server which makes that server available.

What does work: I can get the openvpn-client docker running without an issue, and from that docker I can connect to the server. After installing nginx in the running openvpn-client docker and adding a proxy_pass and a port forward I can reach the server.

But now I'm trying to set it up in a somewhat more stable manner, but this is where I'm stuck. I actually don't even need the Nginx in the docker since I already have a Nginx running in another docker that I use for reverse proxying, so I could use that (due to port conflicts, I need to use that in the end).

What would be the best way to fix this? Add a few iptables rules in the openvpn-client docker to forward the external port to the webserver? I've tried the with the dperson/nginx docker as well but that seems to be connecting to the openvpn-cllient machine instead of the remote machine so that's pretty useless in this scenario.

wolph avatar Sep 07 '20 16:09 wolph

I'm unclear on your intention. Are you trying to forward a port from your host machine through the docker container and over the VPN?

gynnantonix avatar Sep 14 '20 17:09 gynnantonix

No, the other way around.

I'm trying to connect to a firewalled server that's only reachable through the VPN. For convenience I want to setup a local reverse proxy so I can easily reach that service from my phone/laptop/etc. without having to setup the VPN connection on each of them.

wolph avatar Sep 14 '20 17:09 wolph

have you found a resolution to this? i'm facing the same issue as well

nolramnat avatar May 12 '21 07:05 nolramnat

No, not yet unfortunately, but I would still be happy with a solution since I'm still stuck with the same issue.

Ideally we should be able to execute some iptables rules and possibly some routing rules automatically after starting the docker. That would probably need a little bit of scripting though as the IP is probably not constant

wolph avatar May 12 '21 09:05 wolph