Installing and configuring caching nameserver (named) on Linux (Centos5)
Advantage: Reduces the delay in domain name resolution drastically as the requests for frequently accessed websites are served from cache. Google for cache nameserver to learn more.
Installing caching-nameserver:
# yum install bind bind-utils caching-nameserver -y
Configuring caching-nameserver:
The main configuration file reside in /etc/named.conf
You can find configuration file by using the command
# rpm -qc bind
Not much need to be changed in this file, however if you want to cascade your ISP DNS servers as forwarder, then edit the named.conf and add forwarder directive under the 'options' section.
options {
listen-on port 53 { 127.0.0.1; };
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 { localhost; };
recursion yes; // This option for enable caching
max-cache-size 10m; //cache size of 10MB for dns
cleaning-interval 15; // clean the cache every 15 min
// Replace the IPs with the DNS of your ISP
forwarders {
192.168.0.240;
8.8.8.8;};
};
Starting caching-nameserver:
# service named start
Or
# /etc/init.d/named start
To make named start every time you reboot your machine
# chkconfig --level 35 named on
Or
# setup
Go to "System services" and check named
Using caching-nameserver:
To use your caching-nameserver, add the following line to /etc/resolv.conf
nameserver 127.0.0.1
Now your system will use your own nameserver (in caching mode) for resolving all domain names
$ dig safesquid.com
Query time: 8 msec
First time the response time will be little high, next time the DNS query response will be served from local cache and will takes very little time
$ dig safesquid.com
$ Query time: 0 msec
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.