Setup DNS server Bind chroot CentOS 6


I. Edit /etc/hosts
# vi /etc/hosts

II. Install & Setting Bind chroot for DNS Server
-Install Bind
# yum -y install bind bind-chroot


-Setting iptables open DNS port
# system-config-firewall-tui

or

# iptables -A INPUT -p udp -m state --state NEW --dport 53 -j ACCEPT
# iptables -A INPUT -p tcp -m state --state NEW --dport 53 -j ACCEPT
# service iptables save
# service iptables restart

-Konfigurasi awal
# cp -R /usr/share/doc/bind-9.8.2/sample/var/named/* /var/named/chroot/var/named/
# cp -R /usr/share/doc/bind-9.8.2/sample/etc/* /var/named/chroot/etc/
# touch /var/named/chroot/var/named/data/cache_dump.db
# touch /var/named/chroot/var/named/data/named_stats.txt
# touch /var/named/chroot/var/named/data/named_mem_stats.txt
# touch /var/named/chroot/var/named/data/named.run
# mkdir /var/named/chroot/var/named/dynamic
# touch /var/named/chroot/var/named/dynamic/managed-keys.bind
# chmod -R 777 /var/named/chroot/var/named/data
# chmod -R 777 /var/named/chroot/var/named/dynamic

-Set if you don’t use IPv6(if use, don’t set it)
# echo 'OPTIONS="-4"' >> /etc/sysconfig/named

-Setting RNDC
# rndc-confgen -a -c /etc/rndc.key
# chmod 755 /etc/rndc.key

-Konfigurasi /var/named/chroot/etc/named.conf
# touch /var/named/chroot/etc/named.conf
# vi /var/named/chroot/etc/named.conf

-Setting Forward Lookup Zone
# cd /var/named/chroot/var/named
# touch bachem.local.zone
# vi bachem.local.zone

-Setting Reverse Lookup Zone
# cd /var/named/chroot/var/named
# touch 192.168.99.0.zone
# vi 192.168.99.0.zone

-Edit /etc/resolv.conf
# vi /etc/resolv.conf

-Restart Bind service & Setting run level
# service named restart
# chkconfig named on

Make sure it’s running:
# rndc status

-Testing DNS Query

References:
http://www.server-world.info/en/note?os=CentOS_6&p=dns&f=1
http://www.ehowstuff.com/how-to-configure-bind-chroot-dns-server-on-centos-6-2/
http://blog.wains.be/2007/12/13/centos-5-chroot-dns-with-bind/
http://adlinux.blogspot.com/2010/04/chroot-dns-with-bind-centos-5.html
http://www.digitalpeer.com/id/configuringa
http://docstore.mik.ua/orelly/networking_2ndEd/dns/ch10_15.htm


Related posts:

3 Comments

  1. hello, thanks for your great post. It help to me.
    but, I get an error after the service named restart command.

    [root@rpidvoproxy rpidavao]# service named restart
    Stopping named: [ OK ]
    Starting named:
    Error in named configuration:
    zone localhost.localdomain/IN: loaded serial 0
    zone localhost/IN: loaded serial 0
    zone 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 0
    zone 1.0.0.127.in-addr.arpa/IN: loaded serial 0
    zone 0.in-addr.arpa/IN: loaded serial 0
    zone rpilinux.com/IN: loading from master file rpidvoproxy.rpilinux.com failed: file not found
    zone rpilinux.com/IN: not loaded due to errors.
    internal/rpilinux.com/IN: file not found
    zone 0.1.11.172.in-addr.arpa/IN: loaded serial 2012113002
    [FAILED]
    [root@rpidvoproxy rpidavao]#

    give some advice that is this error.

    Thanks.

      1. hello bachem.

        thanks your time to reply.

        I repeat your instruction “-Konfigurasi awal” , then copy from your named.conf and paste into my named.conf and some editing information of hostname, ip’s, slave ip.

        After repeating those instrucition, then named restart…. wow! its running now, then dig 172.11.56.
        I thinks there is mistake of my named.conf….

        Again, thanks for your time.
        labradorg

Leave a Reply

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