How to configure caching-only name server

If your workstations connected to internet and using internet services, and if your DNS server is outside your network, the name resolution requests can take more time. If you have a caching-only name server in your network, these name resolution queries are stored locally, so that again if you have a name resolution query from any of you network client for the same host resolved before, you can save significant time.

The following RPMs need to be installed on the Linux computer, which is going to function as caching-only nameserver.

• bind (includes DNS server, named)

• bind-utils (utilities for querying DNS servers about host information)

• bind-libs (libraries used by the bind server and utils package)

• bind-chroot (tree of files which can be used as a chroot jail for bind)

• caching-nameserver (config files for a simple caching nameserver)

The default configuration file for the caching-only name server is /etc/named.caching-nameserver.conf . A sample /etc/named.caching-nameserver.conf configuration file is copied below.

[root@RHEL01 ~]# cat /etc/named.caching-nameserver.conf
// named.caching-nameserver.conf
// Provided by Red Hat caching-nameserver package to configure the
// ISC BIND named(8) DNS server as a caching only nameserver
// (as a localhost DNS resolver only).
// See /usr/share/doc/bind*/sample/ for example named configuration files.
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
options {
listen-on port 53 {; };
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";
query-source port 53;
query-source-v6 port 53;
allow-query { localhost; };
logging {
channel default_debug {
file "data/";
severity dynamic;
view localhost_resolver {
match-clients { localhost; };
match-destinations { localhost; };
recursion yes;
include "/etc/named.rfc1912.zones";

• The options directive provides basic DNS directives.

The listen-on port (and listen-on-v6 port) directives-as well as the query-source port (and query-source-v6 port) directives-specify the TCP/IP port number (for IPv4 and IPv6).

If you're extending this to your local network, you'll need to include the IP address of the local network card. If your local network card address is, the above directive would be as shown below. Remember to keep the semi-colon at the end.

listen-on port 53 {;; }

The directory directive tells your DNS server where to look for data files. In above sample configuration file it is /var/named. Remember that if you've installed the bind-chroot RPM, these files will be linked to /var/named/chroot/ subdirectories.

The dump-file specifies the cache for the current DNS database and the output from the rndc dumpdb command.

The statistics-file specifies the cache for the current DNS database and the output from the rndc stats command.

The memstatistics-file specifies the location for memory usage statistics.

The allow-query lists the IP addresses allowed to get information from this server. If this caching-only DNS server is providing service to network, you should make change as shown below.

allow-query {;; }

• The logging directive specifies several more parameters; the channel directive specifies output methods, in this case to default_debug, activated in the data/ subdirectory, logging only dynamic issues.

• The view localhost_resolver directive identifies this caching nameserver as the client and destination for the localhost computer, with the settings described in /etc/named.rfc1912.zones.

Once the changes you require in the configuration file is made, you need to copy the /etc/named.caching-nameserver.conf file to /var/named.conf.

Related Tutorials
• Common Linux network tools - ping, telnet, netstat and arp
• Linux xinetd Super Server daemon
• Linux Network Interface Configuration tool - ifconfig
• Important Linux network configuration files
• How to configure Dynamic Host Configuration Protocol (DHCP) in Linux
• Introduction to Domain Name System (DNS)
• Linux Domain Name System (DNS) client configuration files /etc/hosts, /etc/nsswitch.conf and /etc/resolv.conf
• Berkeley Internet Name Domain (BIND) as a DNS server
• BIND configuration file (/etc/named.conf)
• Domain Name System (DNS) zone files
• RNDC (Remote Name Daemon Control)