Setting up BIND on CentOS

The following steps were used to setup BIND using yum on CentOS 5.4. Assume the hostname is titan.steamr.com.
At the time of this writing, the yum repo had BIND 9.3

Step 1: Install the necessary packages:

yum -y install bind bind-libs bind-utils

Step 2: Create a new file /etc/named.conf with the following contents. Change titan.steamr.com for the hostname.
vi /etc/named.conf

options
{
     directory "/var/named"; // the default
};

zone "localhost" {
     type master;
     file "localhost.zone";
};

zone "titan.steamr.com" {
     type master;
     file "titan.steamr.com.zone";
};

Step 3: Create a new file /etc/named/localhost.zone with the following contents:

$TTL    86400
@               IN SOA  @       root (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

                IN NS           @
                IN A            127.0.0.1
                IN AAAA         ::1

Step 4: Create a new file /etc/named/titan.steamr.com.zone with the following contents: (Change titan.steamr.com with your hostname)

$TTL    86400
titan.steamr.com.       14400   IN SOA  tns1.steamr.com root (
                                        20110000        ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

titan.steamr.com.       14400   IN NS           tns1.steamr.com
titan.steamr.com.       14400   IN NS           tns2.steamr.com
titan.steamr.com.       14400   IN A            67.215.230.73
localhost               14400   IN A            127.0.0.1
www                     14400   IN CNAME        titan.steamr.com
ftp                     14400   IN CNAME        titan.steamr.com

Step 5: Start BIND via /etc/init.d/named start

Step 6: Make BIND start on startup mv /etc/rc3.d/K87named S87named

Step 8: To add other DNS entries, append

zone "new.host.com" {
     type master;
     file "new.host.com.zone";
};

and create a new zone file /var/named/new.host.com.zone with something like the contents in step 4.

You will want to reload BIND once you add a new entry by running /etc/init.d/named reload

Leave a Reply

Your email address will not be published.