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.

Most Read Articles

Add/Detect a new disk in ...

Written By Farooq Mohammed Ahmed on Sunday, 11 January 2015 19:22
Add/Detect a new disk in ...

Replace SSL Certificates ...

Written By Farooq Mohammed Ahmed on Friday, 16 December 2016 08:05
Replace SSL Certificates ...

Using awk in Alias Comman...

Written By Farooq Mohammed Ahmed on Friday, 19 February 2016 14:22
Using awk in Alias Comman...

Sed - Insert Text before ...

Written By Farooq Mohammed Ahmed on Monday, 20 November 2017 00:58
Sed - Insert Text before ...

Script to Monitor Nagios ...

Written By Farooq Mohammed Ahmed on Monday, 18 July 2016 22:48
Script to Monitor Nagios ...