Configuring a Local Caching Nameserver


A caching nameserver builds a local cache of resolved domain names and provides them to other hosts on your LAN. This speeds up DNS searches and saves bandwidth by reusing lookups for frequently accessed domains and is especially useful on a slow dial-up connection or when your ISP's own nameservers malfunction.

If you have BIND and BIND-utils installed on your computer, you can configure a caching nameserver by installing the caching-nameserver package. This sets up the /etc/named.conf configuration file, the /var/named directory, and the configuration files in /var/named (localhost.zone, named.ca, and named.local).

To start the caching nameserver, you can start the named service manually (see Chapter 15, "Automating Tasks") or use the system-config-services GUI configuration tool. This can be started by choosing the Services menu option in the Server Settings menu, which is in the System Settings menu, and then selecting named and clicking the Start button.

To get your local computer to use the caching nameserver, reconfigure the /etc/resolv.conf file to comment out any references to your ISP's nameservers, and set the only nameserver to be the localhost (127.0.0.1). The /etc/resolv.conf for the caching nameserver host is

#/etc/resolv.conf #nameserver 83.64.1.10 #nameserver 83.64.0.10 nameserver 127.0.0.1


Other machines on your network should have the IP of the local caching nameserver in their /etc/resolv.conf files. Assuming that the IP address for the computer running the caching nameserver is 192.168.1.5, the /etc/resolv.conf files on the other machines on your network should be

#/etc/resolv.conf #nameserver 83.64.1.10 #nameserver 83.64.0.10 nameserver 192.168.1.5


AD Blocking with a Caching Nameserver

Another advantage of setting up a caching nameserver is that you can use it to block ads and objectionable sites by using bogus DNS zones to block specific domains. You do this by overriding the DNS lookup of the sites you want to block. Configuration is simple. First, determine the sites that you want to block. For example, you might want to block all access to doubleclick.net. Create an entry in /etc/named.conf like this

zone "doublelick.net" { type master; file "fakes"; };


Then create a new /var/named/fakes file. This should contain

[View full width]

$TTL 1D @ IN SOA wind.maximumhoyt.com. hostmaster .maximumhoyt.com. ( 2004081701 8H 2H 4W 1D) @ IN NS wind.maximumhoyt.example.com. @ IN A 127.0.0.1 * IN A 127.0.0.1


where wind.maximumhoyt.com should be replaced by the hostname of the caching nameserver. This points all DNS lookups of doubleclick.net to 127.0.0.1, where they will not be found. To make the change effective, you have to restart named so that the new configuration information is read. Chapter 15 describes several different ways of restarting the named service; here is one of them:

# kill -HUP 'pidof named'


When named is restarted, attempts to resolve all doubleclick.net addresses fail, the ads are neither loaded nor displayed, and your browsing experience is faster.




Red Hat Fedora 5 Unleashed
Red Hat Fedora 5 Unleashed
ISBN: 067232847X
EAN: 2147483647
Year: 2004
Pages: 362

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net