How to Install and Configure Bind 9 DNS on CentOS 6.3

bindThis post covers the steps on how to install Bind DNS server on CentOS 6.3. 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.

1. To install Bind 9 on linux CentOS 6.3 server, run the following command :

[root@centos63 ~]# yum install bind -y

Examples :

[root@centos63 ~]# yum install bind -y
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
 * base: ossm.utm.my
 * extras: ossm.utm.my
 * updates: ossm.utm.my
CentOS6.3-Repository                                                         | 4.0 kB     00:00 ...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind.i686 32:9.8.2-0.10.rc1.el6_3.2 will be installed
--> Processing Dependency: portreserve for package: 32:bind-9.8.2-0.10.rc1.el6_3.2.i686
--> Running transaction check
---> Package portreserve.i686 0:0.0.4-9.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package            Arch        Version                           Repository                   Size
====================================================================================================
Installing:
 bind               i686        32:9.8.2-0.10.rc1.el6_3.2         updates                     4.0 M
Installing for dependencies:
 portreserve        i686        0.0.4-9.el6                       CentOS6.3-Repository         22 k

Transaction Summary
====================================================================================================
Install       2 Package(s)

Total download size: 4.0 M
Installed size: 7.2 M
Downloading Packages:
Setting up and reading Presto delta metadata
updates/prestodelta                                                          | 104 kB     00:00
Processing delta metadata
Package(s) data still to download: 4.0 M
(1/2): bind-9.8.2-0.10.rc1.el6_3.2.i686.rpm                                  | 4.0 MB     00:43
----------------------------------------------------------------------------------------------------
Total                                                                93 kB/s | 4.0 MB     00:43
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : portreserve-0.0.4-9.el6.i686                                                     1/2
  Installing : 32:bind-9.8.2-0.10.rc1.el6_3.2.i686                                              2/2
  Verifying  : portreserve-0.0.4-9.el6.i686                                                     1/2
  Verifying  : 32:bind-9.8.2-0.10.rc1.el6_3.2.i686                                              2/2

Installed:
  bind.i686 32:9.8.2-0.10.rc1.el6_3.2

Dependency Installed:
  portreserve.i686 0:0.0.4-9.el6

Complete!

2. Setup and configure zone with the name of example.local :

[root@centos63 ~]# vi /var/named/example.local

Add zone record as below :


;
;       Addresses and other host information.
;
$TTL 86400
@       IN      SOA     example.local. hostmaster.example.local. (
                               2012080701      ; Serial
                               43200      ; Refresh
                               3600       ; Retry
                               3600000    ; Expire
                               2592000 )  ; Minimum

;       Define the nameservers and the mail servers

               IN      NS      ns.example.local.
               IN      A       192.168.1.54
               IN      MX      10 mail.example.local.

mail            IN      A       192.168.1.51
ns              IN      A       192.168.1.54
www             IN      A       192.168.1.54

3. Add example.local zone below to named.conf. This is main configuration file for bind dns server.

Modify named.conf :

[root@centos63 ~]# vi /etc/named.conf

Add the following :

zone "example.local" {
    type master;
    file "/var/named/example.local";
};

Full named.conf configuration file :

//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//

options {
        listen-on port 53 { 127.0.0.1; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query     { localhost; };
        recursion yes;

        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;

        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";

        managed-keys-directory "/var/named/dynamic";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
        type hint;
        file "named.ca";
};

zone "example.local" {
    type master;
    file "/var/named/example.local";
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

4. start Named service :

[root@centos63 ~]# /etc/init.d/named start
Generating /etc/rndc.key:                                  [  OK  ]
Starting named:                                            [  OK  ]

5. If you want to restart and check the named status, execute the following :

[root@centos63 ~]# /etc/init.d/named restart
Stopping named: .                                          [  OK  ]
Starting named:                                            [  OK  ]
[root@centos63 ~]# /etc/init.d/named status
version: 9.8.2rc1-RedHat-9.8.2-0.10.rc1.el6_3.2
CPUs found: 1
worker threads: 1
number of zones: 20
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/0/1000
tcp clients: 0/100
server is up and running
named (pid  2405) is running...

6. For extra checking, verify mx record whether working or not :

[root@centos63 ~]# host -t mx example.local
example.local mail is handled by 10 mail.example.local.

How to Install nslookup on CentOS 6.3

nslookup is part of the bind-utils package. Please note that the host, dig and nslookup are also part of the bind utilities. Without bind-utils package installed, you will get the following error when you try to nslookup any domain:

[root@centos63 ~]# nslookup
-bash: nslookup: command not found.3

To install the nslookup in CentOS 6.3, simply run this command :

[root@centos63 ~]# yum install bind-utils -y
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
 * base: ossm.utm.my
 * extras: ossm.utm.my
 * updates: ossm.utm.my
CentOS6.3-Repository                                                         | 4.0 kB     00:00 ...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind-utils.i686 32:9.8.2-0.10.rc1.el6_3.2 will be installed
--> Processing Dependency: bind-libs = 32:9.8.2-0.10.rc1.el6_3.2 for package: 32:bind-utils-9.8.2-0.10.rc1.el6_3.2.i686
--> Processing Dependency: liblwres.so.80 for package: 32:bind-utils-9.8.2-0.10.rc1.el6_3.2.i686
--> Processing Dependency: libisccfg.so.82 for package: 32:bind-utils-9.8.2-0.10.rc1.el6_3.2.i686
--> Processing Dependency: libisccc.so.80 for package: 32:bind-utils-9.8.2-0.10.rc1.el6_3.2.i686
--> Processing Dependency: libisc.so.83 for package: 32:bind-utils-9.8.2-0.10.rc1.el6_3.2.i686
--> Processing Dependency: libdns.so.81 for package: 32:bind-utils-9.8.2-0.10.rc1.el6_3.2.i686
--> Processing Dependency: libbind9.so.80 for package: 32:bind-utils-9.8.2-0.10.rc1.el6_3.2.i686
--> Running transaction check
---> Package bind-libs.i686 32:9.8.2-0.10.rc1.el6_3.2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package              Arch           Version                                Repository         Size
====================================================================================================
Installing:
 bind-utils           i686           32:9.8.2-0.10.rc1.el6_3.2              updates           180 k
Installing for dependencies:
 bind-libs            i686           32:9.8.2-0.10.rc1.el6_3.2              updates           882 k

Transaction Summary
====================================================================================================
Install       2 Package(s)

Total download size: 1.0 M
Installed size: 2.7 M
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 1.0 M
(1/2): bind-libs-9.8.2-0.10.rc1.el6_3.2.i686.rpm                             | 882 kB     00:09
(2/2): bind-utils-9.8.2-0.10.rc1.el6_3.2.i686.rpm                            | 180 kB     00:01
----------------------------------------------------------------------------------------------------
Total                                                                97 kB/s | 1.0 MB     00:10
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 32:bind-libs-9.8.2-0.10.rc1.el6_3.2.i686                                         1/2
  Installing : 32:bind-utils-9.8.2-0.10.rc1.el6_3.2.i686                                        2/2
  Verifying  : 32:bind-utils-9.8.2-0.10.rc1.el6_3.2.i686                                        1/2
  Verifying  : 32:bind-libs-9.8.2-0.10.rc1.el6_3.2.i686                                         2/2

Installed:
  bind-utils.i686 32:9.8.2-0.10.rc1.el6_3.2

Dependency Installed:
  bind-libs.i686 32:9.8.2-0.10.rc1.el6_3.2

Complete!

Now you can start use nslookup:

[root@centos63 ~]# nslookup
> www.google.com
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
www.google.com  canonical name = www.l.google.com.
Name:   www.l.google.com
Address: 209.85.175.147
Name:   www.l.google.com
Address: 209.85.175.103
Name:   www.l.google.com
Address: 209.85.175.104
Name:   www.l.google.com
Address: 209.85.175.105
Name:   www.l.google.com
Address: 209.85.175.106
Name:   www.l.google.com
Address: 209.85.175.99

How to Install Bind Utilities on Fedora 16

Question :
When i try to test mx record using host command and other bind utility command such as nslookup, i get this error :

[root@fedora16 ~]# host -t mx fedora16.local
-bash: host: command not found

Solution :
BIND Utilities is not a separate package, it is a collection of the client side programs that are included with BIND-9. The BIND package includes the client side programs nslookup, dig and host.

Simply run the following command to install bind-utils on Fedora 16 :

[root@fedora16 ~]# yum install bind-utils -y

Examples :

[root@fedora16 ~]# yum install bind-utils -y
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind-utils.i686 32:9.8.2-1.fc16 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                 Arch              Version                       Repository            Size
====================================================================================================
Installing:
 bind-utils              i686              32:9.8.2-1.fc16               updates              179 k

Transaction Summary
====================================================================================================
Install       1 Package

Total download size: 179 k
Installed size: 411 k
Downloading Packages:
bind-utils-9.8.2-1.fc16.i686.rpm                                             | 179 kB     00:01
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 32:bind-utils-9.8.2-1.fc16.i686                                                  1/1

Installed:
  bind-utils.i686 32:9.8.2-1.fc16

Complete!

Test DNS using host command example :

[root@fedora16 ~]# host -t mx fedora16.local
fedora16.local mail is handled by 10 mail.fedora16.local.

Test DNS using nslookup command example:

[root@fedora16 ~]# nslookup
> ns.fedora16.local
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   ns.fedora16.local
Address: 192.168.1.47
> mail.fedora16.local
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   mail.fedora16.local
Address: 192.168.1.51

How to Install and Configure Bind Chroot DNS Server on Fedora 16

DNS is the Domain Name System that maintains a database that can help user’s computer to translate domain names such as www.ehowstuff.com to IP addresses such as 184.173.214.97. DNS on CentOS and Fedora is based on the named daemon, which is built on the BIND package developed through the Internet Software Consortium. (More information is available from the BIND home page at www.isc.org/products/BIND.) However, these are RPM packages associated with DNS. But not all required to build Bind Chroot DNS Server. bind Includes the basic name server software, including /usr/sbin/named. bind-chroot Includes directories that isolate BIND in a so-called “chroot jail,” which limits access if DNS is compromised. In this post, i will guide you on how to install and configure Bind Chroot DNS server on linux Fedora 16 server.

1. Simply run this command to install Bind Chroot DNS Server :

[root@fedora16 ~]# yum install bind-chroot -y

Examples :

[root@fedora16 ~]# yum install bind-chroot -y
Fedora16-Repository                                                          | 3.7 kB     00:00 ...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind-chroot.i686 32:9.8.2-1.fc16 will be installed
--> Processing Dependency: bind = 32:9.8.2-1.fc16 for package: 32:bind-chroot-9.8.2-1.fc16.i686
--> Running transaction check
---> Package bind.i686 32:9.8.2-1.fc16 will be installed
--> Processing Dependency: bind-libs = 32:9.8.2-1.fc16 for package: 32:bind-9.8.2-1.fc16.i686
--> Processing Dependency: liblwres.so.80 for package: 32:bind-9.8.2-1.fc16.i686
--> Processing Dependency: libisccfg.so.82 for package: 32:bind-9.8.2-1.fc16.i686
--> Processing Dependency: libisccc.so.80 for package: 32:bind-9.8.2-1.fc16.i686
--> Processing Dependency: libisc.so.83 for package: 32:bind-9.8.2-1.fc16.i686
--> Processing Dependency: libdns.so.81 for package: 32:bind-9.8.2-1.fc16.i686
--> Processing Dependency: libbind9.so.80 for package: 32:bind-9.8.2-1.fc16.i686
--> Running transaction check
---> Package bind-libs.i686 32:9.8.2-1.fc16 will be installed
--> Processing Dependency: bind-license = 32:9.8.2-1.fc16 for package: 32:bind-libs-9.8.2-1.fc16.i686
--> Running transaction check
---> Package bind-license.noarch 32:9.8.1-2.fc16 will be updated
--> Processing Dependency: bind-license = 32:9.8.1-2.fc16 for package: 32:bind-libs-lite-9.8.1-2.fc16.i686
---> Package bind-license.noarch 32:9.8.2-1.fc16 will be an update
--> Running transaction check
---> Package bind-libs-lite.i686 32:9.8.1-2.fc16 will be updated
---> Package bind-libs-lite.i686 32:9.8.2-1.fc16 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                   Arch              Version                       Repository          Size
====================================================================================================
Installing:
 bind-chroot               i686              32:9.8.2-1.fc16               updates             71 k
Installing for dependencies:
 bind                      i686              32:9.8.2-1.fc16               updates            2.0 M
 bind-libs                 i686              32:9.8.2-1.fc16               updates            860 k
Updating for dependencies:
 bind-libs-lite            i686              32:9.8.2-1.fc16               updates            621 k
 bind-license              noarch            32:9.8.2-1.fc16               updates             72 k

Transaction Summary
====================================================================================================
Install       3 Packages
Upgrade       2 Packages

Total download size: 3.6 M
Downloading Packages:
(1/5): bind-9.8.2-1.fc16.i686.rpm                                            | 2.0 MB     00:18
(2/5): bind-chroot-9.8.2-1.fc16.i686.rpm                                     |  71 kB     00:00
(3/5): bind-libs-9.8.2-1.fc16.i686.rpm                                       | 860 kB     00:07
(4/5): bind-libs-lite-9.8.2-1.fc16.i686.rpm                                  | 621 kB     00:04
(5/5): bind-license-9.8.2-1.fc16.noarch.rpm                                  |  72 kB     00:00
----------------------------------------------------------------------------------------------------
Total                                                               113 kB/s | 3.6 MB     00:32
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : 32:bind-license-9.8.2-1.fc16.noarch                                              1/7
  Installing : 32:bind-libs-9.8.2-1.fc16.i686                                                   2/7
  Installing : 32:bind-9.8.2-1.fc16.i686                                                        3/7
  Installing : 32:bind-chroot-9.8.2-1.fc16.i686                                                 4/7
  Updating   : 32:bind-libs-lite-9.8.2-1.fc16.i686                                              5/7
  Cleanup    : 32:bind-libs-lite-9.8.1-2.fc16.i686                                              6/7
  Cleanup    : 32:bind-license-9.8.1-2.fc16.noarch                                              7/7

Installed:
  bind-chroot.i686 32:9.8.2-1.fc16

Dependency Installed:
  bind.i686 32:9.8.2-1.fc16                      bind-libs.i686 32:9.8.2-1.fc16

Dependency Updated:
  bind-libs-lite.i686 32:9.8.2-1.fc16              bind-license.noarch 32:9.8.2-1.fc16

Complete!

2. Create a file /var/named/chroot/var/named/fedora16.local with the following configuration:

[root@fedora16 ~]# vi /var/named/chroot/var/named/fedora16.local

Examples :

;
;       Addresses and other host information.
;
@       IN      SOA     fedora16.local. hostmaster.fedora16.local. (
                               2012051901      ; Serial
                               43200      ; Refresh
                               3600       ; Retry
                               3600000    ; Expire
                               2592000 )  ; Minimum

;       Define the nameservers and the mail servers

               IN      NS      ns.fedora16.local.
               IN      A       192.168.1.47
               IN      MX      10 mail.fedora16.local.

mail            IN      A       192.168.1.51
ns              IN      A       192.168.1.47

3. Generate an RNDC key :
The rndc tool is used to managed the named daemon. We need to generate a keyfile called /etc/rndc.key which is referenced both by /etc/rndc.conf and /etc/named.conf To do this we use the following command :

[root@fedora16 ~]# rndc-confgen -a -c /etc/rndc.key
wrote key file "/etc/rndc.key"

View the content of the RNDC key :

[root@fedora16 ~]# cat /etc/rndc.key
key "rndc-key" {
        algorithm hmac-md5;
        secret "B2rQEFnrdcAzAt2BiUmBug==";
};

4. Edit the /var/named/chroot/etc/named.conf file for fedora16.local

[root@fedora16 ~]# vi /var/named/chroot/etc/named.conf
options {
       directory "/var/named";
       dump-file "/var/named/data/cache_dump.db";
       statistics-file "/var/named/data/named_stats.txt";
forwarders { 8.8.8.8; };
};
include "/etc/rndc.key";
// We are the master server for fedora16.local

zone "fedora16.local" {
    type master;
    file "fedora16.local";
};

5. Start the DNS service using the following command :

[root@fedora16 ~]# /etc/init.d/named start
Starting named (via systemctl):                            [  OK  ]

6. Make named daemon auto start during boot :

[root@fedora16 ~]# chkconfig named on

7. Before testing, make sure your pc or server using the Bind Chroot DNS Server that has been set up :

Test DNS using host command :

[root@fedora16 ~]# host -t mx fedora16.local
fedora16.local mail is handled by 10 mail.fedora16.local.

Test DNS using nslookup command :

[root@fedora16 ~]# nslookup
> ns.fedora16.local
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   ns.fedora16.local
Address: 192.168.1.47
> mail.fedora16.local
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   mail.fedora16.local
Address: 192.168.1.51

How to Install and Configure Bind 9 DNS on CentOS 6.2 x86_64

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 linux CentOS 6.2 64 bit server.

To install Bind 9 on linux CentOS 6.2 server, run the following command :

[root@CentOS6.2 ~]# yum install bind -y

Example :

[root@CentOS6.2 ~]# yum install bind -y
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: centos.biz.net.id
 * extras: centos.biz.net.id
 * updates: centos.idrepo.or.id
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind.x86_64 32:9.7.3-8.P3.el6_2.2 will be installed
--> Processing Dependency: bind-libs = 32:9.7.3-8.P3.el6_2.2 for package: 32:bind-9.7.3-8.P3.el6_2.2.x86_64
--> Running transaction check
---> Package bind-libs.x86_64 32:9.7.3-8.P3.el6 will be updated
--> Processing Dependency: bind-libs = 32:9.7.3-8.P3.el6 for package: 32:bind-utils-9.7.3-8.P3.el6.x86_64
---> Package bind-libs.x86_64 32:9.7.3-8.P3.el6_2.2 will be an update
--> Running transaction check
---> Package bind-utils.x86_64 32:9.7.3-8.P3.el6 will be updated
---> Package bind-utils.x86_64 32:9.7.3-8.P3.el6_2.2 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package               Arch              Version                           Repository          Size
====================================================================================================
Installing:
 bind                  x86_64            32:9.7.3-8.P3.el6_2.2             updates            3.9 M
Updating for dependencies:
 bind-libs             x86_64            32:9.7.3-8.P3.el6_2.2             updates            840 k
 bind-utils            x86_64            32:9.7.3-8.P3.el6_2.2             updates            178 k

Transaction Summary
====================================================================================================
Install       1 Package(s)
Upgrade       2 Package(s)

Total download size: 4.9 M
Downloading Packages:
(1/3): bind-9.7.3-8.P3.el6_2.2.x86_64.rpm                                    | 3.9 MB     01:16
(2/3): bind-libs-9.7.3-8.P3.el6_2.2.x86_64.rpm                               | 840 kB     00:15
(3/3): bind-utils-9.7.3-8.P3.el6_2.2.x86_64.rpm                              | 178 kB     00:02
----------------------------------------------------------------------------------------------------
Total                                                                50 kB/s | 4.9 MB     01:39
warning: rpmts_HdrFromFdno: Header V4 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid : CentOS-6 Key (CentOS 6 Official Signing Key) 
 Package: centos-release-6-2.el6.centos.7.x86_64 (@anaconda-CentOS-201112091719.x86_64/6.2)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : 32:bind-libs-9.7.3-8.P3.el6_2.2.x86_64                                           1/5
  Updating   : 32:bind-utils-9.7.3-8.P3.el6_2.2.x86_64                                          2/5
  Installing : 32:bind-9.7.3-8.P3.el6_2.2.x86_64                                                3/5
  Cleanup    : 32:bind-utils-9.7.3-8.P3.el6.x86_64                                              4/5
  Cleanup    : 32:bind-libs-9.7.3-8.P3.el6.x86_64                                               5/5

Installed:
  bind.x86_64 32:9.7.3-8.P3.el6_2.2

Dependency Updated:
  bind-libs.x86_64 32:9.7.3-8.P3.el6_2.2           bind-utils.x86_64 32:9.7.3-8.P3.el6_2.2

Complete!

2. Setup and configure zone with the name of example.com :

[root@CentOS6.2 ~]# vi /var/named/example.com

Create example.com zone as below. You can have different IP addresses if you have installed separate mail server and DNS server :

;
;       Addresses and other host information.
;
@       IN      SOA     example.com. hostmaster.example.com. (
                               2011030801      ; Serial
                               43200      ; Refresh
                               3600       ; Retry
                               3600000    ; Expire
                               2592000 )  ; Minimum

;       Define the nameservers and the mail servers

               IN      NS      ns.example.com.
               IN      A       192.168.1.20
               IN      MX      10 mail.example.com.

mail            IN      A       192.168.1.20
ns              IN      A       192.168.1.20

3. Add example zone below to named.conf. named.conf is main configuration file for bind dns server.

zone "example.com" {
    type master;
    file "example.com";
};

Open named.conf :

[root@CentOS6.2 ~]# vi /etc/named.conf

Add zone “example.com” into the named.conf as below :

//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//

options {
        listen-on port 53 { 127.0.0.1; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query     { localhost; };
        recursion yes;

        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;

        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
        type hint;
        file "named.ca";
};

zone "example.com" {
    type master;
    file "example.com";
};

include "/etc/named.rfc1912.zones";

4. Start named service :

[root@CentOS6.2 ~]# service named start

or

[root@CentOS6.2 ~]# /etc/init.d/named start

5. Configure /etc/resolv.conf to point to this bind dns server (192.168.1.20).

6. Test your dns configuration whether working or not :

[root@CentOS6.2 ~]# host -t mx example.com
example.com mail is handled by 10 mail.example.com.

How to Configure Bind Chroot DNS Server on Linux CentOS 5.7 Server

In this post, i will guide you on how to configure Bind Chroot DNS server on Linux CentOS 5.7 Server. DNS is the Domain Name System that maintains a database that can help user’s computer to translate domain names such as www.ehowstuff.com to IP addresses such as 184.173.214.97. DNS on CentOS is based on the named daemon, which is built on the BIND package developed through the Internet Software Consortium. (More information is available from the BIND home page at www.isc.org/products/BIND.) This steps has been tested on linux CentOS 5.7 but it may working on other version such as CentOS 5.1, CentOS 5.2, CentOS 5.3, CentOS 5.4, CentOS 5.5 and CentOS 5.6.

1. Install Bind Chroot DNS Server :

[root@CentOS57 ~]# yum install bind-chroot -y

2. Create a file /var/named/chroot/var/named/bloggerbaru.local with the following configuration :

[root@CentOS57 ~]# vi /var/named/chroot/var/named/bloggerbaru.local
;
;       Addresses and other host information.
;
@       IN      SOA     bloggerbaru.local. hostmaster.bloggerbaru.local. (
                               2011030801      ; Serial
                               43200      ; Refresh
                               3600       ; Retry
                               3600000    ; Expire
                               2592000 )  ; Minimum

;       Define the nameservers and the mail servers

               IN      NS      ns.bloggerbaru.local.
               IN      A       192.168.1.45
               IN      MX      10 mail.bloggerbaru.local.

mail            IN      A       192.168.1.45
ns              IN      A       192.168.1.45

3. Generate an RNDC key :
The rndc tool is used to managed the named daemon. We need to generate a keyfile called /etc/rndc.key which is referenced both by /etc/rndc.conf and /etc/named.conf. Execute the following command to generate the RNDC key :

[root@CentOS57 ~]# rndc-confgen -a -c /etc/rndc.key
wrote key file "/etc/rndc.key"

4. View the content of the RNDC key :

[root@CentOS57 ~]# cat /etc/rndc.key
key "rndckey" {
        algorithm hmac-md5;
        secret "jwsFpL7OJR+x9w+YRkGrXA==";
};

5. Edit the /var/named/chroot/etc/named.conf file for bloggerbaru.local :

[root@CentOS57 ~]# vi /var/named/chroot/etc/named.conf
options {
       directory "/var/named";
       dump-file "/var/named/data/cache_dump.db";
       statistics-file "/var/named/data/named_stats.txt";
forwarders { 8.8.8.8; };
};
include "/etc/rndc.key";
// We are the master server for bloggerbaru.local

zone "bloggerbaru.local" {
    type master;
    file "bloggerbaru.local";
};

6. Start the DNS service using the following command :

[root@CentOS57 ~]# /etc/init.d/named start
Starting named:                                            [  OK  ]

or

[root@CentOS57 ~]# service named start
Starting named:                                            [  OK  ]

7. To ensure the named daemon will start at boot, execute the following chkconfig :

[root@CentOS57 ~]# chkconfig named on

8. Before testing, make sure your pc or server pointing to the DNS Server that has been set up. In this case, i want to ensure that CentOS 5.7 poiting to itself :

[root@CentOS57 ~]# cat /etc/resolv.conf
nameserver 127.0.0.1

9. Test your DNS service :

[root@CentOS57 ~]# host -t mx bloggerbaru.local
bloggerbaru.local mail is handled by 10 mail.bloggerbaru.local.
[root@CentOS57 ~]# host -t mx bloggerbaru.local
bloggerbaru.local mail is handled by 10 mail.bloggerbaru.local.

How to Install Bind Chroot DNS Server on Linux CentOS 5.7 Server

DNS is the Domain Name System that maintains a database that can help user’s computer to translate domain names such as www.ehowstuff.com to IP addresses such as 184.173.214.97. DNS on CentOS is based on the named daemon, which is built on the BIND package developed through the Internet Software Consortium. (More information is available from the BIND home page at www.isc.org/products/BIND.) In this post, i will guide you on how to install Bind Chroot DNS server on linux CentOS 5.7 server. This steps may working on other version such as CentOS 5.1, CentOS 5.2, CentOS 5.3, CentOS 5.4, CentOS 5.5 and CentOS 5.6.

1. Install Bind Chroot DNS Server on Linux CentOS 5.7 Server

[root@CentOS57 ~]# yum install bind-chroot -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.oscc.org.my
 * extras: mirror.oscc.org.my
 * rpmforge: ftp-stud.fht-esslingen.de
 * updates: mirror.oscc.org.my
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind-chroot.i386 30:9.3.6-20.P1.el5 set to be updated
--> Processing Dependency: bind = 30:9.3.6-20.P1.el5 for package: bind-chroot
--> Running transaction check
---> Package bind.i386 30:9.3.6-20.P1.el5 set to be updated
--> Processing Dependency: bind-libs = 30:9.3.6-20.P1.el5 for package: bind
--> Running transaction check
--> Processing Dependency: bind-libs = 30:9.3.6-16.P1.el5_7.1 for package: bind-utils
---> Package bind-libs.i386 30:9.3.6-20.P1.el5 set to be updated
--> Running transaction check
---> Package bind-utils.i386 30:9.3.6-20.P1.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                  Arch              Version                         Repository         Size
====================================================================================================
Installing:
 bind-chroot              i386              30:9.3.6-20.P1.el5              base               47 k
Installing for dependencies:
 bind                     i386              30:9.3.6-20.P1.el5              base              981 k
Updating for dependencies:
 bind-libs                i386              30:9.3.6-20.P1.el5              base              863 k
 bind-utils               i386              30:9.3.6-20.P1.el5              base              174 k

Transaction Summary
====================================================================================================
Install       2 Package(s)
Upgrade       2 Package(s)

Total download size: 2.0 M
Downloading Packages:
(1/4): bind-chroot-9.3.6-20.P1.el5.i386.rpm                                  |  47 kB     00:00
(2/4): bind-utils-9.3.6-20.P1.el5.i386.rpm                                   | 174 kB     00:01
(3/4): bind-libs-9.3.6-20.P1.el5.i386.rpm                                    | 863 kB     00:07
(4/4): bind-9.3.6-20.P1.el5.i386.rpm                                         | 981 kB     00:08
----------------------------------------------------------------------------------------------------
Total                                                               111 kB/s | 2.0 MB     00:18
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : bind-libs                                                                    1/6
  Installing     : bind                                                                         2/6
  Installing     : bind-chroot                                                                  3/6
  Updating       : bind-utils                                                                   4/6
  Cleanup        : bind-libs                                                                    5/6
  Cleanup        : bind-utils                                                                   6/6

Installed:
  bind-chroot.i386 30:9.3.6-20.P1.el5

Dependency Installed:
  bind.i386 30:9.3.6-20.P1.el5

Dependency Updated:
  bind-libs.i386 30:9.3.6-20.P1.el5                bind-utils.i386 30:9.3.6-20.P1.el5

Complete!

2. Check the DNS named service :

[root@CentOS57 ~]# service named status
rndc: connect failed: 127.0.0.1#953: connection refused
named is stopped

named daemon service is stop, You must configure the bind chroot before you start it.

How to Install and Configure Bind 9 as a Caching Server 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 to act as a caching server on Ubuntu 11.10 linux server.

root@ehowstuff:~# apt-get install bind9 -y

Example :

root@ehowstuff:~# apt-get install bind9 -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  bind9-host bind9utils dnsutils libbind9-60 libcap2 libdns69 libisc62 libisccc60 libisccfg62
  liblwres60
Suggested packages:
  bind9-doc resolvconf rblcheck
The following NEW packages will be installed:
  bind9 bind9utils libcap2
The following packages will be upgraded:
  bind9-host dnsutils libbind9-60 libdns69 libisc62 libisccc60 libisccfg62 liblwres60
8 upgraded, 3 newly installed, 0 to remove and 56 not upgraded.
Need to get 1,592 kB of archives.
After this operation, 1,479 kB of additional disk space will be used.
Get:1 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main dnsutils i386 1:9.7.3.dfsg-1ubuntu4.1 [142 kB]
Get:2 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main bind9-host i386 1:9.7.3.dfsg-1ubuntu4.1 [53.9 kB]
Get:3 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main libisc62 i386 1:9.7.3.dfsg-1ubuntu4.1 [160 kB]
Get:4 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main libdns69 i386 1:9.7.3.dfsg-1ubuntu4.1 [676 kB]
Get:5 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main libisccc60 i386 1:9.7.3.dfsg-1ubuntu4.1 [18.0 kB]
Get:6 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main libisccfg62 i386 1:9.7.3.dfsg-1ubuntu4.1 [38.8 kB]
Get:7 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main liblwres60 i386 1:9.7.3.dfsg-1ubuntu4.1 [38.6 kB]
Get:8 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main libbind9-60 i386 1:9.7.3.dfsg-1ubuntu4.1 [23.0 kB]
Get:9 http://sg.archive.ubuntu.com/ubuntu/ oneiric/main libcap2 i386 1:2.21-2 [12.5 kB]
Get:10 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main bind9utils i386 1:9.7.3.dfsg-1ubuntu4.1 [102 kB]
Get:11 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main bind9 i386 1:9.7.3.dfsg-1ubuntu4.1 [327 kB]
Fetched 1,592 kB in 18s (88.4 kB/s)
Preconfiguring packages ...
(Reading database ... 50749 files and directories currently installed.)
Preparing to replace dnsutils 1:9.7.3.dfsg-1ubuntu4 (using .../dnsutils_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Unpacking replacement dnsutils ...
Preparing to replace bind9-host 1:9.7.3.dfsg-1ubuntu4 (using .../bind9-host_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Unpacking replacement bind9-host ...
Preparing to replace libisc62 1:9.7.3.dfsg-1ubuntu4 (using .../libisc62_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Unpacking replacement libisc62 ...
Preparing to replace libdns69 1:9.7.3.dfsg-1ubuntu4 (using .../libdns69_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Unpacking replacement libdns69 ...
Preparing to replace libisccc60 1:9.7.3.dfsg-1ubuntu4 (using .../libisccc60_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Unpacking replacement libisccc60 ...
Preparing to replace libisccfg62 1:9.7.3.dfsg-1ubuntu4 (using .../libisccfg62_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Unpacking replacement libisccfg62 ...
Preparing to replace liblwres60 1:9.7.3.dfsg-1ubuntu4 (using .../liblwres60_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Unpacking replacement liblwres60 ...
Preparing to replace libbind9-60 1:9.7.3.dfsg-1ubuntu4 (using .../libbind9-60_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Unpacking replacement libbind9-60 ...
Selecting previously deselected package libcap2.
Unpacking libcap2 (from .../libcap2_1%3a2.21-2_i386.deb) ...
Selecting previously deselected package bind9utils.
Unpacking bind9utils (from .../bind9utils_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Selecting previously deselected package bind9.
Unpacking bind9 (from .../bind9_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for ufw ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Setting up libisc62 (1:9.7.3.dfsg-1ubuntu4.1) ...
Setting up libdns69 (1:9.7.3.dfsg-1ubuntu4.1) ...
Setting up libisccc60 (1:9.7.3.dfsg-1ubuntu4.1) ...
Setting up libisccfg62 (1:9.7.3.dfsg-1ubuntu4.1) ...
Setting up libbind9-60 (1:9.7.3.dfsg-1ubuntu4.1) ...
Setting up liblwres60 (1:9.7.3.dfsg-1ubuntu4.1) ...
Setting up bind9-host (1:9.7.3.dfsg-1ubuntu4.1) ...
Setting up dnsutils (1:9.7.3.dfsg-1ubuntu4.1) ...
Setting up libcap2 (1:2.21-2) ...
Setting up bind9utils (1:9.7.3.dfsg-1ubuntu4.1) ...
Setting up bind9 (1:9.7.3.dfsg-1ubuntu4.1) ...
Adding group `bind' (GID 113) ...
Done.
Adding system user `bind' (UID 105) ...
Adding new user `bind' (UID 105) with group `bind' ...
Not creating home directory `/var/cache/bind'.
wrote key file "/etc/bind/rndc.key"
#
 * Starting domain name service... bind9                                                     [ OK ]
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

The main configuration is stored in the following files:

root@ehowstuff:~# ls /etc/bind | grep named
named.conf
named.conf.default-zones
named.conf.local
named.conf.options

To configure bind9 to act as a caching server, all that is required is simply adding the IP numbers of your ISP’s DNS servers or alternatively you can use free google dns server as below :

root@ehowstuff:~# vim /etc/bind/named.conf.options

Uncomment and edit the following in /etc/bind/named.conf.options :

.
.
.
    forwarders {
                8.8.8.8;
         };
.
.
.

Start or restart caching named service :

As a root :

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

or restart bind as normal user :

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

Verify caching dns server completely working using dig command. Use dig command to query google.com :

root@ehowstuff:~# dig www.google.com

; <<>> DiG 9.7.3 <<>> www.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40642
;; flags: qr rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 13, ADDITIONAL: 0

;; QUESTION SECTION:
;www.google.com.                        IN      A

;; ANSWER SECTION:
www.google.com.         86322   IN      CNAME   www.l.google.com.
www.l.google.com.       223     IN      A       209.85.175.99
www.l.google.com.       223     IN      A       209.85.175.103
www.l.google.com.       223     IN      A       209.85.175.104
www.l.google.com.       223     IN      A       209.85.175.105
www.l.google.com.       223     IN      A       209.85.175.106
www.l.google.com.       223     IN      A       209.85.175.147

;; AUTHORITY SECTION:
.                       14355   IN      NS      m.root-servers.net.
.                       14355   IN      NS      l.root-servers.net.
.                       14355   IN      NS      f.root-servers.net.
.                       14355   IN      NS      d.root-servers.net.
.                       14355   IN      NS      k.root-servers.net.
.                       14355   IN      NS      j.root-servers.net.
.                       14355   IN      NS      g.root-servers.net.
.                       14355   IN      NS      h.root-servers.net.
.                       14355   IN      NS      i.root-servers.net.
.                       14355   IN      NS      a.root-servers.net.
.                       14355   IN      NS      e.root-servers.net.
.                       14355   IN      NS      b.root-servers.net.
.                       14355   IN      NS      c.root-servers.net.

;; Query time: 14 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sun Apr  8 16:21:07 2012
;; MSG SIZE  rcvd: 359

How to Configure Bind Chroot DNS Server on CentOS 6.2

In this post, i will show you on how to configure Bind Chroot DNS Server on CentOS 6.2. Assumed that you have installed Bind Chroot DNS.

1. Install Bind Chroot DNS Server

    [root@centos62 ~]# yum install bind-chroot -y
    

2. Create a file /var/named/chroot/var/named/ehowstuff.local with the following configuration:

    [root@centos62 ~]# vi /var/named/chroot/var/named/ehowstuff.local
    
    ;
    ;       Addresses and other host information.
    ;
    @       IN      SOA     ehowstuff.local. hostmaster.ehowstuff.local. (
                                   2011030801      ; Serial
                                   43200      ; Refresh
                                   3600       ; Retry
                                   3600000    ; Expire
                                   2592000 )  ; Minimum
     
    ;       Define the nameservers and the mail servers
     
                   IN      NS      ns.ehowstuff.local.
                   IN      A       192.168.1.44
                   IN      MX      10 mail.ehowstuff.local.
     
    mail            IN      A       192.168.1.42
    ns              IN      A       192.168.1.44
    

3. Generate an RNDC key :
The rndc tool is used to managed the named daemon. We need to generate a keyfile called /etc/rndc.key which is referenced both by /etc/rndc.conf and /etc/named.conf To do this we use the following command;

    [root@centos62 ~]# rndc-confgen -a -c /etc/rndc.key
    wrote key file "/etc/rndc.key"
    

View the content of the RNDC key :

    [root@centos62 ~]# cat /etc/rndc.key
    key "rndc-key" {
            algorithm hmac-md5;
            secret "T6tduqyMQ/YbIDXOmE0Fzg==";
    };
    

4. Edit the /var/named/chroot/etc/named.conf file for ehowstuff.local

    [root@centos62 ~]# vi /var/named/chroot/etc/named.conf
    
    options {
           directory "/var/named";
           dump-file "/var/named/data/cache_dump.db";
           statistics-file "/var/named/data/named_stats.txt";
    forwarders { 8.8.8.8; };
    };
    include "/etc/rndc.key";
    // We are the master server for ehowstuff.local
    
    zone "ehowstuff.local" {
        type master;
        file "ehowstuff.local";
    };
    

5. Start the DNS service using the following command :

    [root@centos62 ~]# /etc/init.d/named start
    Starting named:                                            [  OK  ]
    

6. Make named daemon auto start during boot :

    [root@centos62 ~]# chkconfig named on
    

7. Before testing, make sure your pc or server using the Bind Chroot DNS Server that has been set up :

    [root@centos62 ~]# cat /etc/resolv.conf
    nameserver 192.168.1.44
    

8. Test your DNS service :

    [root@centos62 ~]# host -t mx ehowstuff.local
    ehowstuff.local mail is handled by 10 mail.ehowstuff.local.
    
    [root@centos62 ~]# host -t ns ehowstuff.local
    ehowstuff.local name server ns.ehowstuff.local.
    

How to Install Bind Chroot DNS Server on CentOS 6.2

In this post, i will guide you on how to install Bind Chroot DNS server on CentOS 6.2. DNS is the Domain Name System that maintains a database that can help user’s computer to translate domain names such as www.ehowstuff.com to IP addresses such as 184.173.214.97. DNS on CeentOS is based on the named daemon, which is built on the BIND package developed through the Internet Software Consortium. (More information is available from the BIND home page at www.isc.org/products/BIND.) However, these are RPM packages associated with DNS. But not all required to build Bind Chroot DNS Server.

bind Includes the basic name server software, including /usr/sbin/named.

bind-chroot Includes directories that isolate BIND in a so-called “chroot jail,” which limits access if DNS is compromised.

bind-devel Includes development libraries for BIND.

bind-libbind-devel Contains the libbind BIND resolver library.

bind-libs Adds library files used by the bind and bind-utils RPMs.

bind-sdb Supports alternative databases, such as LDAP. Per the Red Hat Exam Prep guide and course outlines, I see no evidence that such relationships are covered on the Red Hat exams.

bind-utils Contains tools such as dig and host that provide information about a specific Internet host. It should already be installed in any minimum installation of RHEL.

caching-nameserver Includes files associated with a caching nameserver.

system-config-bind A GUI configuration tool useful for adding host and reverse address lookup data. It’s not officially a part of the DNS Name Server package group.

Simply run this command to install Bind Chroot DNS Server :

    [root@centos62 ~]# yum install bind-chroot -y
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: centos.maulvi.net
     * extras: centos.maulvi.net
     * rpmforge: fr2.rpmfind.net
     * updates: centos.maulvi.net
    rpmforge                                                                     | 1.1 kB     00:00
    rpmforge/primary                                                             | 1.5 MB     00:18
    rpmforge                                                                                  4233/4233
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package bind-chroot.i686 32:9.7.3-8.P3.el6_2.2 will be installed
    --> Processing Dependency: bind = 32:9.7.3-8.P3.el6_2.2 for package: 32:bind-chroot-9.7.3-8.P3.el6_2.2.i686
    --> Running transaction check
    ---> Package bind.i686 32:9.7.3-8.P3.el6_2.2 will be installed
    --> Processing Dependency: bind-libs = 32:9.7.3-8.P3.el6_2.2 for package: 32:bind-9.7.3-8.P3.el6_2.2.i686
    --> Processing Dependency: libdns.so.69 for package: 32:bind-9.7.3-8.P3.el6_2.2.i686
    --> Processing Dependency: libbind9.so.60 for package: 32:bind-9.7.3-8.P3.el6_2.2.i686
    --> Processing Dependency: libisccc.so.60 for package: 32:bind-9.7.3-8.P3.el6_2.2.i686
    --> Processing Dependency: libisccfg.so.62 for package: 32:bind-9.7.3-8.P3.el6_2.2.i686
    --> Processing Dependency: liblwres.so.60 for package: 32:bind-9.7.3-8.P3.el6_2.2.i686
    --> Processing Dependency: libisc.so.62 for package: 32:bind-9.7.3-8.P3.el6_2.2.i686
    --> Running transaction check
    ---> Package bind-libs.i686 32:9.7.3-8.P3.el6_2.2 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ====================================================================================================
     Package                Arch            Version                            Repository          Size
    ====================================================================================================
    Installing:
     bind-chroot            i686            32:9.7.3-8.P3.el6_2.2              updates             68 k
    Installing for dependencies:
     bind                   i686            32:9.7.3-8.P3.el6_2.2              updates            3.9 M
     bind-libs              i686            32:9.7.3-8.P3.el6_2.2              updates            850 k
    
    Transaction Summary
    ====================================================================================================
    Install       3 Package(s)
    
    Total download size: 4.8 M
    Installed size: 9.2 M
    Downloading Packages:
    (1/3): bind-9.7.3-8.P3.el6_2.2.i686.rpm                                      | 3.9 MB     00:35
    (2/3): bind-chroot-9.7.3-8.P3.el6_2.2.i686.rpm                               |  68 kB     00:00
    (3/3): bind-libs-9.7.3-8.P3.el6_2.2.i686.rpm                                 | 850 kB     00:08
    ----------------------------------------------------------------------------------------------------
    Total                                                               109 kB/s | 4.8 MB     00:45
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
    Warning: RPMDB altered outside of yum.
      Installing : 32:bind-libs-9.7.3-8.P3.el6_2.2.i686                                             1/3
      Installing : 32:bind-9.7.3-8.P3.el6_2.2.i686                                                  2/3
      Installing : 32:bind-chroot-9.7.3-8.P3.el6_2.2.i686                                           3/3
    
    Installed:
      bind-chroot.i686 32:9.7.3-8.P3.el6_2.2
    
    Dependency Installed:
      bind.i686 32:9.7.3-8.P3.el6_2.2                bind-libs.i686 32:9.7.3-8.P3.el6_2.2
    
    Complete!
    

Next : How to Configure Bind Chroot DNS Server on CentOS 6.2

How to Install nslookup on CentOS

nslookup is part of the bind-utils package. Without bind-utils package installed, you will get the following error when you try to nslookup any domain:

[root@centos6 ~]# nslookup
-bash: nslookup: command not found

To install the nslookup in CentOS, simply run this command :

[root@centos6 ~]# yum install bind-utils
Loaded plugins: fastestmirror
Determining fastest mirrors
CentOS6.2-Repository                                                  | 1.3 kB     00:00 ...
CentOS6.2-Repository/primary                                          | 1.2 MB     00:00 ...
CentOS6.2-Repository                                                               3042/3042
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind-utils.i686 32:9.7.3-8.P3.el6 will be installed
--> Processing Dependency: bind-libs = 32:9.7.3-8.P3.el6 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: liblwres.so.60 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libisccfg.so.62 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libisccc.so.60 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libisc.so.62 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libdns.so.69 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libbind9.so.60 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Running transaction check
---> Package bind-libs.i686 32:9.7.3-8.P3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================
 Package           Arch        Version                     Repository                   Size
=============================================================================================
Installing:
 bind-utils        i686        32:9.7.3-8.P3.el6           CentOS6.2-Repository        177 k
Installing for dependencies:
 bind-libs         i686        32:9.7.3-8.P3.el6           CentOS6.2-Repository        849 k

Transaction Summary
=============================================================================================
Install       2 Package(s)

Total download size: 1.0 M
Installed size: 2.6 M
Is this ok [y/N]: n
Exiting on user Command
[root@centos6 ~]# nslookup
-bash: nslookup: command not found
[root@centos6 ~]# yum install bind-utils
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind-utils.i686 32:9.7.3-8.P3.el6 will be installed
--> Processing Dependency: bind-libs = 32:9.7.3-8.P3.el6 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: liblwres.so.60 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libisccfg.so.62 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libisccc.so.60 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libisc.so.62 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libdns.so.69 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libbind9.so.60 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Running transaction check
---> Package bind-libs.i686 32:9.7.3-8.P3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================
 Package           Arch        Version                     Repository                   Size
=============================================================================================
Installing:
 bind-utils        i686        32:9.7.3-8.P3.el6           CentOS6.2-Repository        177 k
Installing for dependencies:
 bind-libs         i686        32:9.7.3-8.P3.el6           CentOS6.2-Repository        849 k

Transaction Summary
=============================================================================================
Install       2 Package(s)

Total download size: 1.0 M
Installed size: 2.6 M
Is this ok [y/N]: y
Downloading Packages:
---------------------------------------------------------------------------------------------
Total                                                        6.1 MB/s | 1.0 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 32:bind-libs-9.7.3-8.P3.el6.i686                                          1/2
  Installing : 32:bind-utils-9.7.3-8.P3.el6.i686                                         2/2

Installed:
  bind-utils.i686 32:9.7.3-8.P3.el6

Dependency Installed:
  bind-libs.i686 32:9.7.3-8.P3.el6

Complete!

Now you can start use nslookup:

[root@centos6 ~]# nslookup
> www.google.com
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
www.google.com  canonical name = www.l.google.com.
Name:   www.l.google.com
Address: 209.85.175.105
Name:   www.l.google.com
Address: 209.85.175.106
Name:   www.l.google.com
Address: 209.85.175.147
Name:   www.l.google.com
Address: 209.85.175.99
Name:   www.l.google.com
Address: 209.85.175.103
Name:   www.l.google.com
Address: 209.85.175.104
> set type=ns
> www.google.com
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
www.google.com  canonical name = www.l.google.com.

Authoritative answers can be found from:
l.google.com
        origin = ns1.google.com
        mail addr = dns-admin.google.com
        serial = 1473322
        refresh = 900
        retry = 900
        expire = 1800
        minimum = 60
>

How to Fix nslookup, host, dig: -bash: command not found in Linux?

Symptoms:

When i try to verify the dns and run a few dns command utilities such as host, dig and nslookup, below error appeared:

    [root@mail ~]# host -t mx zimbra.local
    bash: host: command not found
    [root@mail ~]# dig -t mx zimbra.local
    bash: dig: command not found
    [root@mail ~]# nslookup -t mx zimbra.local
    bash: nslookup: command not found
    

Findings:
If you have above problems in your Linux server, probably you might be missing the package that contains bind utilities. Please note that the host, dig and nslookup are part of the bind utilities.

Solution:

Run this command to install the bind utilities.

    [root@mail ~]# yum install bind-utils
    Setting up Install Process
    Setting up repositories
    Reading repository metadata in from local files
    Parsing package install arguments
    Resolving Dependencies
    --> Populating transaction set with selected packages. Please wait.
    ---> Downloading header for bind-utils to pack into transaction set.
    bind-utils-9.3.6-4.P1.el5_4.2.i386.rpm                                      |  43 kB     00:00
    ---> Package bind-utils.i386 30:9.3.6-4.P1.el5_4.2 set to be updated
    --> Running transaction check
    
    Dependencies Resolved
    
    =============================================================================
     Package                 Arch       Version          Repository        Size
    =============================================================================
    Installing:
     bind-utils              i386       30:9.3.6-4.P1.el5_4.2  rhellocalrepo     170 k
    
    Transaction Summary
    =============================================================================
    Install      1 Package(s)
    Update       0 Package(s)
    Remove       0 Package(s)
    Total download size: 170 k
    Is this ok [y/N]: y
    Downloading Packages:
    Running Transaction Test
    warning: bind-utils-9.3.6-4.P1.el5_4.2: Header V3 DSA signature: NOKEY, key ID 37017186
    Finished Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing: bind-utils                   ######################### [1/1]
    
    Installed: bind-utils.i386 30:9.3.6-4.P1.el5_4.2
    Complete!