Enable BIND DNS forwarding incl Reverse Lookup – RaspberryPi

by | Dec 24, 2015 | Debian Wheezy (7)

It’s possible to enable DNS forwarding using BIND and including reverse lookup for the zone. Once you are done with the config of a basic bind server, all you need to do is configure “/etc/bind/named.conf.options and conf.local” with the following options and restart the service.

In this example we have got 2 DNS server’s resolving.

SERVER1 = raspi-qud.hm.local = domain : HM.LOCAL : IP: 172.16.64.1

SERVER 2 = viz-raspi-st.dev.local = domain : DEV.LOCAL :IP: 172.16.66.212

We need to resolve local requests for “hm.local” on SERVER 1 and forward any “dev.local” domain requests (forward and reverse lookups) to SERVER 2 and hence need to configure SERVER 1  to achieve this.

To start with add the zone dev.local to “/etc/bind/named.conf.local” and add the forward zone to the config file.

# vi /etc/bind/named.conf.local

zone "dev.local" {         
type forward;
                forwarders {
                              172.16.66.212;
                                 };
};

 Then edit “/etc/bind/named.conf” options to authorize forward and reverse lookups.

# vi /etc/bind/named.conf.options

## Update or add these entries
dnssec-validation no;               ### This is for enabling forward lookup
forwarders (                        ### This is to enable reverse lookup for the forwarded DNS server
                     172.16.66.212;
};

 Then restart the bind service for the changes to take effect

# service bind9 restart

 You can now see from the below output that I can query from  hm.local –> dev.local domain.

OUTPUT:

Before: Forward Lookup

root@raspi-quad:~# hostname
raspi-quad.hm.local
root@raspi-quad:~# host viz-raspi-st.dev.local
Host viz-raspi-st.dev.local not found: 3(NXDOMAIN)

After : Forward Lookup

root@raspi-quad:~# hostname
raspi-quad.hm.local
root@raspi-quad:~# host viz-raspi-st.dev.local
viz-raspi-st.dev.local has address 172.16.66.212

Before : Reverse Lookup

root@raspi-quad:~# hostname
raspi-quad.hm.local
root@raspi-quad:~# host 172.16.66.212
Host 212.66.16.172.in-addr.arpa. not found: 3(NXDOMAIN)

After: Reverse lookup

root@raspi-quad:~# hostname
raspi-quad.hm.local
root@raspi-quad:~# host 172.16.66.212
212.66.16.172.in-addr.arpa domain name pointer viz-raspi-st.dev.local.

Related Articles….