Friday, February 19, 2010

Installing and configuring caching nameserver (named) on Linux (Fedora 12)

To configure caching-nameserver on local machine in my case on my laptop running Fedora 12, local caching nameserver which will use "cascade" to other functional DNS server in this case my ISP DNS servers.

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 caching-nameserver

Configuring caching-nameserver:

The main configuration file reside in /etc/named.conf

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;
    // Replace the IPs with the DNS of your ISP
    forwarders { 192.168.36.204; 192.168.36.210; };
        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside . trust-anchor dlv.isc.org.;
};

And if you do not want to use 'dnssec' then disable it by...

dnssec-enable no;
dnssec-validation no;


Starting caching-nameserver:

# service named start

Or

# /etc/init.d/named start

To make named start every time you reboot your machine

# chkconfig 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 askarali.org
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 askarali.org
$ Query time: 0 msec

1 comment:

  1. Excellent work askar ali keep rocking and update so many things its very easy to learn

    Hats off

    ReplyDelete