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:
 * extras:
 * updates:
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
 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

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

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


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
               IN      MX      10 mail.example.local.

mail            IN      A
ns              IN      A
www             IN      A

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

READ  How to Configure Email on Android

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 {; };
        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/";
                severity dynamic;

zone "." IN {
        type hint;
        file "";

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.
Leave a Reply

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

A world leading hosting company that provides fully-managed innovative and secure solutions, suitable for hosting small to medium-sized websites

Built on the best available technologies combined with Google Cloud for strong redundancy and application availability. Backed by skilled experts to address web security threats, a devops team to create advanced custom security solutions, and 24/7 sysadmins to watch over the platform. This powerful, hands-on approach makes your sites faster, safer, and easier to manage. Starting from only $3.95/mo.


* up to 30 days money back guarantee