Install Caching-Only DNS server on CentOS 6.4

From wikipedia, The Domain Name System (DNS) is a hierarchical distributed naming system for computers, services, or any resource connected to the Internet or a private network.

Assume the IP of the caching-only DNS server is 192.168.1.2.

Install bind packages
# yum install bind bind-chroot bind-utils -y

Configure Caching-Only DNS server
# cd /var/named/chroot/etc/
# cp /etc/named.* .
# chown root:named named.*

Edit the named.conf file
# vi named.conf
options {
   listen-on port 53 { 127.0.0.1; 192.168.1.2; };
   listen-on-v6 port 53 { ::1; };
   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”;
   allow-query { any; };
   allow-query-cache { any; };
   recursion yes;

   dnssec-enable yes;
   dnssec-validation yes;
   dnssec-lookaside auto;

   /* Path to ISC DLV key */
   bindkeys-file “/etc/named.iscdlv.key”;

   managed-keys-directory “/var/named/dynamic”;
};

logging {
   channel default_debug {
      file “data/named.run”;
      severity dynamic;
   };
};

zone “.” IN {
   type hint;
   file “named.ca”;
};

include “/etc/named.rfc1912.zones”;
include “/etc/named.root.key”;

Make sure that ROOTDIR is /var/named/chroot
# awk “/^[^#]/” /etc/sysconfig/named
ROOTDIR=/var/named/chroot

Start named service
# service named start

Make named service start at boot time
# chkconfig named on

Test on other server
# dig @192.168.1.2 google.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.4 <<>> @192.168.1.2 google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1328
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 4, ADDITIONAL: 4

;; QUESTION SECTION:
;google.com. IN A

;; ANSWER SECTION:
google.com. 289 IN A 74.125.26.100
google.com. 289 IN A 74.125.26.113
google.com. 289 IN A 74.125.26.138
google.com. 289 IN A 74.125.26.102
google.com. 289 IN A 74.125.26.139
google.com. 289 IN A 74.125.26.101

;; AUTHORITY SECTION:
google.com. 172787 IN NS ns3.google.com.
google.com. 172787 IN NS ns2.google.com.
google.com. 172787 IN NS ns4.google.com.
google.com. 172787 IN NS ns1.google.com.

;; ADDITIONAL SECTION:
ns2.google.com. 172787 IN A 216.239.34.10
ns1.google.com. 172787 IN A 216.239.32.10
ns3.google.com. 172787 IN A 216.239.36.10
ns4.google.com. 172787 IN A 216.239.38.10

;; Query time: 0 msec
;; SERVER: 192.168.1.2#53(192.168.1.2)
;; WHEN: Tue May 28 15:54:36 2013
;; MSG SIZE rcvd: 260

Advertisements
This entry was posted in Linux Admin Basics. Bookmark the permalink.

6 Responses to Install Caching-Only DNS server on CentOS 6.4

  1. Pingback: Install and Configure Authoritative DNS server on CentOS 6.4 | Simon (Jingbo)'s IT blog

  2. Pingback: Install and Configure Master and Slave DNS Servers on CentOS 6.4 | Simon (Jingbo)'s IT blog

  3. Jeffrey says:

    dude you really rock man!!! :-) Thank you for this great info. you saved me from pulling my hair out in the office. Please keep up the good work :-)

  4. anonymous says:

    Tahnk you

  5. Meg Vasquez says:

    Hi there! This blog post could not be written much better!
    Looking at this article reminds me of my previous roommate!
    He constantly kept talking about this. I will
    send this article to him. Fairly certain he’s going to have a very good read.
    Thanks for sharing!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s