Friday, February 5, 2010

Caching-nameserver quick howto for centos 5.4

To setup caching-nameserver:

1. Install bind, bind-chroot and caching-nameserver (bind is the nameserver, bind-chroot is to make bind operate in chroot environment and caching-nameserver is the BIND default setting for caching nameserver)
# yum install bind bind-chroot caching-nameserver

2. All bind configuration files will be stored in /var/named/chroot because of the bind-chroot package. A file named "named.caching-nameserver.conf" will be created in /var/named/chroot/etc. Rename the file to "named.conf"
# cd /var/named/chroot/etc
# mv named.caching-nameserver.conf named.conf

3. Edit named.conf until it become like below and save:
options {
listen-on port 53 { any; };
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; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
match-clients { any; };
match-destinations { any; };
recursion yes;
include "/etc/named.rfc1912.zones";
};

4. Set /etc/resolv.conf to point to localhost
# echo "nameserver 127.0.0.1" > /etc/resolv.conf

5. Restart your nameserver
# /etc/init.d/named restart


Done :)

No comments: