RHEL6/CentOS Caching Name Server

Install the bind-chroot package (which will call the bind package as a dependency):

# yum install bind-chroot

Then make SELinux happy. Set named_write_master_zones to 1:


# setsebool -P named_write_master_zones 1

Allow queries on port 53 for DNS requests:

# iptables -A INPUT -m state –state NEW -m tcp -p tcp –dport 53 -j ACCEPT
 
# iptables -A INPUT -m state –state NEW -m udp -p udp –dport 53 -j ACCEPT

Open /etc/named.conf and configure the options:

options { 
#listen-on port 53 { 127.0.0.1; any; }; (can be commented if there is no firewall between me and the DNS Server I'm talking to)
#listen-on-v6 port 53 { ::1; }; (can be commented if there is no firewall between me and the DNS Server I'm talking to)
directory       "/var/named";
dump-file       "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
query-source    port 53;
query-source-v6 port 53;

allow-query     { localhost; any; };
recursion yes;
forwarders      { 192.168.1.1; };  #IP of the DNS to which we forward queries
forward only;
dnssec-enable no; (Disable DNSSEC)
dnssec-validation no; (Disable DNSSEC)

dnssec-lookaside auto;

Open /etc/resolve.conf

change your nameserver to 127.0.0.1

Restart the named service

#service named restart