How to install BIND on Ubuntu


DNS Stands for Domain Name Service.On the Internet, the Domain Name Service (DNS) stores and associates many types of information with domain names; most importantly, it translates domain names (computer hostnames) to IP addresses. It also lists mail exchange servers accepting e-mail for each domain. In providing a worldwide keyword-based redirection service, DNS is an essential component of contemporary Internet use.

BIND (Berkeley Internet Name Domain) is an open reference implementation of the Domain Name System (DNS) protocol and provides a redistributable implementation of the major components of the Domain Name System.

  • a name server (named)
  • a resolver library
  • troubleshooting tools like nslookup and dig

The BIND DNS Server is used on the vast majority of name serving machines on the Internet, providing a robust and stable architecture on top of which an organization’s naming architecture can be built. The resolver library included in the BIND distribution provides the standard APIs for translation between domain names and Internet addresses and is intended to be linked with applications requiring name service.

Installing Bind

Become a super user

user@server:~# sudo su -

Install Bind 9 using apt-get

root@server:~# apt-get install bind9 bind9-doc dnsutils

Configuring Bind

Now go to the directory where the Bind’s configuration files is located and delete all the configuration files (except rndc.key) as we will create anew one.

root@server:~# cd /etc/bind/
root@server:~# ls
db.0 db.127 db.255 db.empty db.local db.root named.conf named.conf.local named.conf.options rndc.key zones.rfc1918
root@server:~# rm db* named* zone*

Create bind main configuration file “named.conf” as per sample below. You may modified to fit your requirements.

options {
directory "/var/cache/bind";
version "Bind";
#hostname of this server
hostname "";

#set from which IP the bind server should listen. We set only from local. is IP address of bind servers machine
listen-on {;; };

#set from which IP range the bind server should allow query
allow-query {;; };

#forward all the request to external DNS server first
forward first;
forwarders {;;
#create a zone
zone "" IN {
type master;
#location of the zone configuration file
file "/etc/bind/";
allow-update { none; };

DNS zone is a portion of the global DNS namespace. This namespace is defined by RFC 1034, Domain Names – Concepts and Facilities and RFC 1035, Domain Names – Implementation and Specification, and is laid out in a tree structure from right to left, such that divisions of the namespace are performed by prepending a series of characters followed by period (‘.’), to the upper namespace

Now create the zone file as what we defined above. Below the is the sample file.

@ IN SOA (
19 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
www IN CNAME @
xchl IN A
intranet IN A
reports IN A
web IN A

Add the DNS server’s IP address in /etc/resolv.conf. (Note: This also need to be done on clients site)

nameserver #Local DNS server. On client site, change to servers IP (e.g: 192.168.0.x)
nameserver #ISP DNS server. Do not add this on clients machine
nameserver #ISP DNS server. Do not add this on clients machine

We are done with the configuration. Start the bind server

root@server:~# /etc/init.d/bind9 start
* Starting domain name service... [ ok ]