How to Install and Configure Bind Chroot DNS Server on RHEL 6

In this post, i will guide you on how to install and configure Bind Chroot DNS server on Redhat Enterprise Linux 6 (RHEL 6). DNS is the Domain Name System that maintains a database that can help user’s computer to translate domain names to IP addresses. This post will show the installation and configuration for bind-chroot 9.7 version. Assumed that you have configured your RHEL 6 with local yum repository as per documented in the following post.
How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on RHEL 6

1. Install Bind Chroot DNS Server

[root@rhel6 ~]# yum install bind-chroot -y
Loaded plugins: rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind-chroot.i686 32:9.7.0-5.P2.el6 set to be updated
--> Processing Dependency: bind = 32:9.7.0-5.P2.el6 for package: 32:bind-chroot-9.7.0-5.P2.el6.i686
--> Running transaction check
---> Package bind.i686 32:9.7.0-5.P2.el6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package              Arch          Version                     Repository                     Size
====================================================================================================
Installing:
 bind-chroot          i686          32:9.7.0-5.P2.el6           DVD-RHEL6-Repository           65 k
Installing for dependencies:
 bind                 i686          32:9.7.0-5.P2.el6           DVD-RHEL6-Repository          3.5 M

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

Total download size: 3.5 M
Installed size: 6.4 M
Downloading Packages:
----------------------------------------------------------------------------------------------------
Total                                                                30 MB/s | 3.5 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : 32:bind-9.7.0-5.P2.el6.i686                                                  1/2
  Installing     : 32:bind-chroot-9.7.0-5.P2.el6.i686                                           2/2

Installed:
  bind-chroot.i686 32:9.7.0-5.P2.el6

Dependency Installed:
  bind.i686 32:9.7.0-5.P2.el6

Complete!

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

[root@rhel6 ~]# 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.43
               IN      MX      10 mail.bloggerbaru.local.

mail            IN      A       192.168.1.43
ns              IN      A       192.168.1.43

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@rhel6 ~]# rndc-confgen -a -c /etc/rndc.key
wrote key file "/etc/rndc.key"

4. View the content of the RNDC key :

[root@rhel6 ~]# cat /etc/rndc.key
key "rndc-key" {
        algorithm hmac-md5;
        secret "rDy6d+XB4NiAnHWA5N7Jig==";
};

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

[root@rhel6 ~]# 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@rhel6 ~]# /etc/init.d/named start
Starting named:                                            [  OK  ]

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

[root@rhel6 ~]# chkconfig named on

8. Before testing, make sure your pc or server pointing to the DNS Server that has been set up :

[root@rhel6 ~]# cat /etc/resolv.conf
nameserver 192.168.1.43

9. Test your DNS service :

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

How to Reset the Directory Manager Password on RHEL 7 / CentOS 7
How to Reset the Directory Manager Password on RHEL 7 / CentOS 7

It is best practice to remember passwords, but because too many passwords, sometimes we forget. We are not encouraged to write the password on any paper or share the password...

How to Find Big Files Size on Linux RHEL/CentOS
How to Find Big Files Size on Linux RHEL/CentOS

As the linux administrator, sometimes we have to identify which files are most take much space in the linux server resulting in low free space. Low disk space can also...

Why Linux users should worry about malware and what they can do about it
Why Linux users should worry about malware and what they can do about it

Don’t drop your guard just because you’re running Linux. Preventing the spread of malware and/or dealing with the consequences of infection are a fact of life when using computers. If...

How to Reset Forgotten Root Password on Linux RHEL 7/CentOS 7
How to Reset Forgotten Root Password on Linux RHEL 7/CentOS 7

This article will explain the steps to reset a lost root password or to reset forgotten root password on Linux RHEL 7 or CentOS 7. Basically, the steps will adding...

How to Update CentOS or Upgrade CentOS to the Latest Version
How to Update CentOS or Upgrade CentOS to the Latest Version

Recently, the latest version of CentOS 7.3 was released. All users of CentOS 7.0, 7.1 and 7.2 can upgrade their system to the most recent. This quick guide will explain...

How to Change your WordPress Username, Nickname and Display Name in MySQL
How to Change your WordPress Username, Nickname and Display Name in MySQL

After you create an account log in WordPress, you may want to change your WordPress username, as appropriate or due to security reason. However, you can not do this from...

How to Enable SSH Root Login on Ubuntu 16.04
How to Enable SSH Root Login on Ubuntu 16.04

As what we wrote in the previous article on how to allow SSH root on Ubuntu 14.04, after installing a fresh new copy of Ubuntu 16.04 LTS, we find that...

How to Change UUID of Linux Partition on CentOS 7
How to Change UUID of Linux Partition on CentOS 7

UUID (Universally Unique IDentifier) should be unique and it is used to identify storage devices on a linux system. If you cloned a virtual machine from vCenter, the metadata containing...

Leave a Reply

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