Enable BIND DNS forwarding incl Reverse Lookup - RaspberryPi

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.

RasPi Related Articles......

Its now possible to install the latest version of Nagios NRPE v 3.0.1 (source install) on RaspberryPi (incl. Pixel OS).
In Raspberry Pi from version Jessie onwards the "root" login for SSH sessions (via Putty Login) has been disabled by...
If you are getting this error while installing Nagios Core on RaspberryPi run these commands to resolve the error and...
Its now possible to install latest Nagios CORE version on Raspbian by following the steps in this article. Before writing...
Wake-On-LAN (WOL) is a very useful feature if you have got a LAB at home and want to make it...