Configuring a Local Caching Nameserver

 < Day Day Up > 

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 ISPs 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 configuration file /etc/named.conf, 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 14, "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 using the Start button.

To get your local computer to use the caching nameserver, reconfigure the file /etc/resolv.conf 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, then 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 may 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 file /var/named/fakes. This should contain

$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 will point all DNS lookups of doubleclick.net to 127.0.0.1, where they will not be found. To make the change effective, you will need to restart named so that the new configuration information is read. Chapter 14 describes several different ways of restarting the named service, here is one of them:

 # kill -HUP 'pidof named' 

Once named has been restarted, attempts to resolve all doubleclick.net addresses will fail, the ads will not be loaded and will not be displayed, and your browsing experience will be faster.


     < Day Day Up > 


    Red Hat Fedora 4 Unleashed
    Red Hat Fedora 4 Unleashed
    ISBN: 0672327929
    EAN: 2147483647
    Year: 2006
    Pages: 361

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