How to setup DNS server behind a VPN

Posted by Brian on Super User See other posts from Super User or by Brian
Published on 2012-11-17T04:13:29Z Indexed on 2012/11/17 5:04 UTC
Read the original article Hit count: 500

Filed under:
|
|

I want to host some websites behind a VPN and I need some help with the finer points of the configuration. Thus far I've settled on OpenVPN + Bind9 and I want to configure the domains like this:

External DNS

mail.example.com 
www.example.com
vpn.example.com

I want to be able to connect to the vpn using 'vpn.example.com'. Once connected I then want to be able to resolve anything which is '*.vpn.example.com' with the DNS server sitting behind the VPN.

I know that OpenVPN can push DNS servers to clients when they connect. I am having trouble though with the DNS config, both internal and external. I've gone through a few tutorials etc. and tried to reason about it myself but I'm not getting anywhere.

So my main question would be does the above configuration make sense? If so, any general pointers or examples would be greatly appreciated.

Here's what I've tried so far based on this tutorial (I've redacted my domain with example.com). When I try the tests with dig at the end to check the resolution is working it fails.

db.vpn.example.com

$TTL 15m
vpn.example.com. IN    SOA     ns.vpn.example.com.   [email protected]. (
                                            2009010910 ;serial
                                            900 ;refresh
                                            900 ;retry
                                            900 ;expire
                                            900 ;minimum TTL
)
vpn.example.com.       IN NS   ns.vpn.example.com.
ns                     IN A    192.168.0.2
test                   IN A    192.168.0.2

© Super User or respective owner

Related posts about dns

Related posts about openvpn