How to Install and Configure Bind9 DNS on Ubuntu 11.10

Bind is the most popular software and the most widely used Domain Name System (DNS) software on the Internet for providing DNS services. The name BIND stands for “Berkeley Internet Name Domain” and it’s an implementation of the DNS protocols. In this post i will show the steps how to install and configure Bind 9 DNS service on Ubuntu 11.10 linux server.

1. Install Bind9 :

ehowstuff@ehowstuff:~$ sudo apt-get install bind9 -y

2. Setup and configure zone with the name of ehowstuff.local

ehowstuff@ehowstuff:~$ sudo vim /etc/bind/named.conf.local

Add a DNS zone to BIND9. Edit named.conf.local as below :

// Do any local configuration here

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

zone "ehowstuff.local" {
             type master;
             file "/etc/bind/db.ehowstuff.local";

3. Copy and Use an existing zone file as a template:

ehowstuff@ehowstuff:/etc/bind$ sudo cp /etc/bind/db.local /etc/bind/db.ehowstuff.local

Edit the new zone file db.ehowstuff.local.

ehowstuff@ehowstuff:~$ sudo vim /etc/bind/db.ehowstuff.local

Change configuration as below :

; BIND data file for local loopback interface
$TTL    604800
@       IN      SOA     ns.ehowstuff.local. root.ehowstuff.local. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
@       IN      NS      ns.ehowstuff.local.
ns      IN      A
box     IN      A

4. Any changes that you’ve made to the zone file BIND9 will need to be restarted before it to take effect:

ehowstuff@ehowstuff:~$ sudo /etc/init.d/bind9 restart
 * Stopping domain name service... bind9                                            [ OK ]
 * Starting domain name service... bind9                                            [ OK ]

5. Make sure you own workstation or server pointing to dns server. In this case, this Ubuntu server pointed to itself since it’s running bind9.

ehowstuff@ehowstuff:~$ sudo vim /etc/resolv.conf

6. test your bind9 server :

ehowstuff@ehowstuff:~$ nslookup
> set type=ns
> ehowstuff.local

ehowstuff.local nameserver = ns.ehowstuff.local.

How to install Bind DNS server on CentOS and RHEL

This steps show you on how to install Bind DNS for CentOS or Redhat Enterprise (RHEL) using yum command :

    [root@server ~]# yum install bind-chroot
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * addons:
     * base:
     * contrib:
     * extras:
     * updates:
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package bind-chroot.x86_64 30:9.3.6-4.P1.el5_5.3 set to be updated
    --> Processing Dependency: bind = 30:9.3.6-4.P1.el5_5.3 for package: bind-chroot
    --> Running transaction check
    ---> Package bind.x86_64 30:9.3.6-4.P1.el5_5.3 set to be updated
    --> Finished Dependency Resolution
    Dependencies Resolved
     Package           Arch         Version                     Repository     Size
     bind-chroot       x86_64       30:9.3.6-4.P1.el5_5.3       updates        44 k
    Installing for dependencies:
     bind              x86_64       30:9.3.6-4.P1.el5_5.3       updates       986 k
    Transaction Summary
    Install       2 Package(s)
    Upgrade       0 Package(s)
    Total download size: 1.0 M
    Is this ok [y/N]: y
    Downloading Packages:
    (1/2): bind-chroot-9.3.6-4.P1.el5_5.3.x86_64.rpm         |  44 kB     00:00
    (2/2): bind-9.3.6-4.P1.el5_5.3.x86_64.rpm                | 986 kB     00:09
    Total                                            85 kB/s | 1.0 MB     00:12
    Running rpm_check_debug
    Running Transaction Test
    Finished Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing     : bind                                                     1/2
      Installing     : bind-chroot                                              2/2
      bind-chroot.x86_64 30:9.3.6-4.P1.el5_5.3
    Dependency Installed:
      bind.x86_64 30:9.3.6-4.P1.el5_5.3