How to Configure Bind Chroot DNS Server on CentOS 6.2

Share this Article :

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

    [[email protected] ~]# yum install bind-chroot -y
    

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

    [[email protected] ~]# 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;

    [[email protected] ~]# rndc-confgen -a -c /etc/rndc.key
    wrote key file "/etc/rndc.key"
    

View the content of the RNDC key :

    [[email protected] ~]# 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

    [[email protected] ~]# 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 :

    [[email protected] ~]# /etc/init.d/named start
    Starting named:                                            [  OK  ]
    

6. Make named daemon auto start during boot :

    [[email protected] ~]# chkconfig named on
    

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

    [[email protected] ~]# cat /etc/resolv.conf
    nameserver 192.168.1.44
    

8. Test your DNS service :

    [[email protected] ~]# host -t mx ehowstuff.local
    ehowstuff.local mail is handled by 10 mail.ehowstuff.local.
    
    [[email protected] ~]# host -t ns ehowstuff.local
    ehowstuff.local name server ns.ehowstuff.local.
    

One Response

  1. wminside

Leave a Reply