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 { 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";
query-source port 53;
query-source-v6 port 53;
allow-query { localhost; };
};
logging {
channel default_debug {
file "data/named.run";
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 192.168.1.1, the above directive would be as shown below. Remember to keep the semi-colon at the end.
listen-on port 53 { 127.0.0.1; 192.168.1.1; }
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 192.168.1.0 network, you should make change as shown below.
allow-query { 127.0.0.1; 192.168.1.0/24; }
• The logging directive specifies several more parameters; the channel directive specifies output methods, in this case to default_debug, activated in the data/ named.run 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.