Install Bind9 for DNS Services on Ubuntu

This article gives you a step by step on installing bind9 to Ubuntu Server for dns resolution for an internal ‘local’ domain. This was done on Ubuntu 10.04 LTS 64 bit and also on 12.04 LTS 64 bit.   The zone ‘mydomain.local’ can be renamed to anything really.   I like to keep internal domains as ‘local’ on split dns so that there is a clear distinction between mydomain.com and mydomain.local addresses.  Internal subnet space used here is 192.168.1.0/255.255.255.0

Install Bind9 for DNS services

1) Run  apt-get install bind9

2) Create a zones folder “mkdir /etc/bind/zones

3) Edit /etc/bind/named.conf.local

zone "mydomain.local" {
type master;
file “/etc/bind/zones/mydomain.local.db";
};

zone "1.168.192.in-addr.arpa" {
type master;
notify no;
file “/etc/bind/zones/rev-192.168.1.db";
};

4) Create the Zone files for mydomain.local. Replace ‘server1’ with your dns server name and adjust IP addresses as needed.

vim /etc/bind/zones/mydomain.local.db

 $ORIGIN .
 $TTL 604800     ; 1 week
 mydomain.local             IN SOA  server1.mydomain.local. admin.mydomain.local. (
 2011032909 ; serial
 604800     ; refresh (1 week)
 86400      ; retry (1 day)
 2419200    ; expire (4 weeks)
 604800     ; minimum (1 week)
 )

NS      server1.mydomain.local.
 $ORIGIN mydomain.local.
 server1                 A       192.168.1.10
 server2                 A       192.168.1.11
 gateway                A       192.168.1.1

5) Create the reverse Zone file vim /etc/bind/zones/rev-192.168.1.db

$ORIGIN .
 $TTL 604800     ; 1 week
 1.168.192.in-addr.arpa IN SOA  server1.mydomain.local. admin.mydomain.local. (
 2012080301 ; serial
 604800     ; refresh (1 week)
 86400      ; retry (1 day)
 2419200    ; expire (4 weeks)
 604800     ; minimum (1 week)
 )

NS      server1.
 $ORIGIN 1.168.192.in-addr.arpa.
 1                       PTR     gateway.mydomain.local.
 15                     PTR     server1.mydomain.local.
 245                   PTR     server2.mydomain.local.

6) Lastly don’t forget to add the forwarders by editing /etc/bind/named.conf.options

forwarders {
 208.67.222.222;
 208.67.220.220;
 };
Bookmark the permalink.

2 Responses to Install Bind9 for DNS Services on Ubuntu

  1. rahul pareek says:

    Is the creating zone file is like creating a domain . and when should we use resolv.conf .

    • mike says:

      The Zone files are needed so that the DNS server would 1) know what zones it is handling and 2) be able to use the zone files to return the correct info.

      Resolv.conf is usually used to configure the name servers and search domain for the host.

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve : *
28 − 13 =