<p>Yes, this is possible. </p>

<p>You can create a private DNS zone for <code>example.io</code> using AWS route53 in the AWS VPC where your openvpn server is running. Then you can point <code>server.example.io</code> to the private IP of the instance. 
By default in AWS VPC, if a private DNS zone is present, it gets the preference. If the DNS record is not present, then it goes out of VPC for DNS resolution. </p>

<p>So, when your users are connected to the VPN, they all will be in the same network of AWS VPC. Hitting <code>server.example.io</code> will resolve to private IP and requests will be routed internally within VPN tunnel.</p>

<p>NOTE: If you are using multiple VPC or your <code>server.example.io</code> is in another VPC, you may need to add routes for that in your VPN configuration.</p>

CC BY-SA 4.0
2019-11-06T00:24:27.317Z
2019-11-06T00:24:27.317Z
Samit
<p>Try to add your public IP to OpenVPN routing/network, if your DNS name is using a static public IP. So OpenVPN will add a route to the client. But you need to add another route that routes from OpenVPN instance to the <code>server.example.io</code> to go through internal network.</p>

CC BY-SA 4.0
2019-01-07T17:13:25.463Z
2019-01-07T17:13:25.463Z
Can
<p>I think you should use split tunnel in order to let client resolve to the public DNS. Or add the recode on the hosts file of OpenVPN server to let it resolve the record.</p>

CC BY-SA 4.0
2019-06-08T17:37:22.527Z
2019-06-08T17:37:22.527Z
N.Kaewkhat
<p>I have an OpenVPN server running in an AWS VPC and I can ping my servers over the tunnel via their private IP, so from that perspective it's working.</p>

<p>Some of our servers have public DNS names <code>server.example.io</code> and I'd like OpenVPN clients to be able to reach the servers using their DNS names over the tunnels. For example, one of our servers has a UI and rather than typing the private IP of the server in the browser, they should be able to reach the server over the tunnel using the public domain name. </p>

<p>Is this possible? We are using the OpenVPN Access Server AMI.</p>

<vpn>
OpenVPN - routing public domain over tunnel?
Caledonia91
# OpenVPN - routing public domain over tunnel?

(Asked by: username_0 on 2019-01-07)

I have an OpenVPN server running in an AWS VPC and I can ping my servers over the tunnel via their private IP, so from that perspective it's working.

Some of our servers have public DNS names `server.example.io` and I'd like OpenVPN clients to be able to reach the servers using their DNS names over the tunnels. For example, one of our servers has a UI and rather than typing the private IP of the server in the browser, they should be able to reach the server over the tunnel using the public domain name.

Is this possible? We are using the OpenVPN Access Server AMI.

**Tags:** vpn


---

## 3 answers

### Answer by username_1 on 2019-11-06. Score: 1

Yes, this is possible.

You can create a private DNS zone for `example.io` using AWS route53 in the AWS VPC where your openvpn server is running. Then you can point `server.example.io` to the private IP of the instance.
By default in AWS VPC, if a private DNS zone is present, it gets the preference. If the DNS record is not present, then it goes out of VPC for DNS resolution.

So, when your users are connected to the VPN, they all will be in the same network of AWS VPC. Hitting `server.example.io` will resolve to private IP and requests will be routed internally within VPN tunnel.

NOTE: If you are using multiple VPC or your `server.example.io` is in another VPC, you may need to add routes for that in your VPN configuration.


---

### Answer by username_2 on 2019-01-07. Score: 0

Try to add your public IP to OpenVPN routing/network, if your DNS name is using a static public IP. So OpenVPN will add a route to the client. But you need to add another route that routes from OpenVPN instance to the `server.example.io` to go through internal network.


---

### Answer by username_3 on 2019-06-08. Score: 0

I think you should use split tunnel in order to let client resolve to the public DNS. Or add the recode on the hosts file of OpenVPN server to let it resolve the record.


---

