Accessing some ports of OpenVPN server external IP through VPN

This forum is for admins who are looking to build or expand their OpenVPN setup.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
Le_Cocotier
OpenVpn Newbie
Posts: 1
Joined: Thu Aug 26, 2021 9:36 am

Accessing some ports of OpenVPN server external IP through VPN

Post by Le_Cocotier » Thu Aug 26, 2021 9:49 am

Hi,

In my setup, I have a computer hosting several web services (web server, mail server, dns server, ssh, openvpn server...). All these services are accessible through external IP adress "EXTERNAL IP". Port 443 is shared between HTTPS & OpenVPN server.

Accessing from outside, when router is blocking mails from exemple, I can access the OpenVPN server on 443 as it's shared with HTTPS and not blocked in many cases.

Now the issue is that, if I want to access other services on "EXTERNAL IP", it's blocked because the route to "EXTERNAL IP" is not within the VPN, as OpenVPN client needs to access directly port 443 on remote server. So I can't check my emails if it's blocked where I am.

As my mail client is configured to use hostnames and not IP, if I force locally on my computer the hostname resolution of "MY SERVER" to "VPN SERVER INTERNAL IP ON VPN NETWORK" (10.8.0.1 in my case) instead of "EXTERNAL IP", it's working fine.

But I would like to do something easier, thinking of the following:
- Route ALL TRAFFIC (including traffic to VPN server external IP) through VPN, excluding 443
- Connect to VPN server using IP address (instead of hostname) in OpenVPN configuration file, and push DNS on connection so that "EXTERNAL HOSTNAME" resolves as "INTERNAL IP ON OPENVPN NETWORK" when VPN connection is established.
- Any other ideas?

The OpenVPN client is running on Windows, so I don't find easy way to do advanced routing. I don't think OpenVPN server offers the possibility to push DNS. Any suggestions are welcome.

Post Reply