DNS over VPN

Recently i got my hands on an M350G5 HP server. Which is completly whitelisted for Esxi 5.*
So now i have two ESXI machines. One at my home and one at my dad’s house.

I planned out some VM’s like ubuntu desktop, vcenter etc etc.
On both addresses i have Fritz!box 7390 routers. Which are capable of setting up a LAN to LAN vpn tunnel quite easily. (No hassle ;))

So far so good, but i have a DNS at my home with ip 192.168.0.122 and i wanted to use that DNS in my dad’s network aswell.

My DNS server is a Centos 6.5 (Chroot) bind server. Which has records for all VM’s and machines with a static ip like routers etc.

But then the trouble began. I wasnt able to resolve from my dad’s house to mine.. But to make a long story short, there is an easy trick to get the DNS server working on both networks.

In the /etc/named.conf file, there is this bit:

options {
        listen-on port 53 { 127.0.0.1; 192.168.0.122;};
        listen-on-v6 port 53 { ::1; };
        directory       /var/named
        dump-file       /var/named/data/cache_dump.db
        statistics-file /var/named/data/named_stats.txt
        memstatistics-file /var/named/data/named_mem_stats.txt
        allow-query     { localhost; 192.168.0.0/24;};

We want to focus on the allow-query part.
As you can see now there is only one network allowed besides the localhost. At my home i have the ip range of 192.168.0.0/24, but at my dad’s house it is 192.168.1.0.
After an entire day of trial and error i stumbled upon a forum post which pointed me in this direction.
Simply change to:

allow-query     { localhost; 192.168.0.0/24; 192.168.1.0/24;};

All your dig / nslookup / ping tests will work.

To be sure this works, please perform a service named restart as root.
Important note: Please be aware that the network settings can be different for you. Change them to the range your network is using.

Leave a comment