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.