How to setup DNS BIND service in Ubuntu OS

How to setup DNS BIND service in Ubuntu OS

Purpose – To install and configure the DNS BIND server in Ubuntu for hostname (FQDN) to IP address resolution and vice-versa

Pre-requisities
OS – Ubuntu 12.04

sudhir@Ubuntu1:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION=”Ubuntu 12.04.3 LTS”

Procedure

Step1: Update the repositories to get the newest versions of the packages and their dependencies

$ sudo apt-get update

Step2: Install bind and its dependent packages

$ sudo apt-get install bind9

Also, install the clients package useful for testing and troubleshooting DNS issues if already not installed

$ sudo apt-get install dnsutils

Step3: Add a DNS zone to bind9, turning bind9 into a primary master server for the domain galaxy.com (Fully Qualified domain name)

Configure the named.conf.local bind file as show below

$ sudo vi /etc/bind/named.conf.local

Step4: Configure the named.conf.options file with the DNS server IP address to which the requests will be forwarded

Step 5: Edit the new zone files with the Fully qualified domain name and the machine names that the DNS server will know

$ sudo mkdir /etc/bind/zones
$ sudo vi /etc/bind/zones/galaxy.com.db

Step6: Edit the reverse zone file as show below

$ sudo vi /etc/bind/zones/rev.121.168.192.in-addr.arpa

Step7: Restart the bind9 service as below

$ sudo service bind9 restart

or

$ sudo /etc/init.d/bind9 restart

Step8: Edit the /etc/resolv.conf with the search domain_name and nameserver IP address as show below

Step9: Test the DNS

Note – Here a static IP address (192.168.121.100) has been configured for the Host machine.

Hope you enjoyed reading this article. Thank you.