First off lets get this straight, all DNS Servers cache. However, some DNS Servers intended to only provide the caching function. Which is what we are going to configure today.
A Caching-only DNS server does not contain zone information or a zone database. Its cache only contains information based on the results of queries that it has already performed. In this case, the cache takes the place of the zone database file for the lookups that you are already doing.
Here’s how its done
First step you need to install bind via yum.
# yum install bind && chkconfig bind
Now configure named to start at boot and start it up
# chkconfig named on && service named start
Then modify /etc/named.conf and change these two lines
listen-on port 53 { 127.0.0.1; };
listen-on-v6 port 53 { ::1; };
to this
listen-on port 53 { any; };
listen-on-v6 port 53 { any; };
then change this the dnssec-validation line to no as seen below.
dnssec-validation no;
Then configure named to accept lookups from its local network by changing the line below
allow-query { localhost; };
To what you see below, note that 10.1.224.0 is my local network
allow-query { localhost; 10.1.224.0/24; };
Now don’t forget to insert a forwarders entry to forward requests to your local dns server. Look in your resolv.conf for this info.
forwarders { 10.100.4.16; };
Then modify your /etc/resolv.conf so that your machine uses itself for name lookups, you do this by adding the line below as the first nameserver.
nameserver localhost
Now start named and do an nslookup, the server and address should point back to local host.
# nslookup fatmin.com
Server: 127.0.0.1
Address: 127.0.0.1#53Non-authoritative answer:
Name: fatmin.com
Address: 64.202.189.170