Implementing a caching-only DNS on Debian

After 3 years of sticking with Novell, I recently switched away from openSUSE to Debian. There are a few reasons why, but I won't bore you with them. So far I'm liking it. There are a few things to set up before I settle in, and one is slow DNS lookup.

I described how and why to make a caching-only DNS on openSUSE in July 2010.  In Debian it's a little different:

  1. Install bind of course. The package is called bind9 and installs itself as a service and starts automatically, no need to mess with runlevels:
    # aptitude install bind9
  2. The config for bind in Debian is a subdirectory structure in /etc/bind.  For a simple caching-only server, you leave /etc/bind/named.conf untouched and instead change /etc/bind/named.conf.options to have your forwarders:
    // MJL20120111 - Adding Google2, OpenDNS1, gateway
    
    forwarders {
        8.8.4.4; 208.67.222.222; 192.168.1.1;
    };
  3. Restart bind to load the new configuration:
    # service bind9 restart
  4. You will need to change your network to use the local bind. I used NetworkManager on the GNOME desktop, but you can just edit /etc/resolv.conf:
    nameserver 127.0.0.1 #local bind
    If you edit the file by hand, you'll have to restart the network somehow (haven't found out how yet, except with NetworkManager).
  5. Done. Test it:
    nslookup australia.gov.au
    Server:127.0.0.1
    Address:127.0.0.1#53Non-authoritative answer:
    Name:australia.gov.au
    Address: 205.239.168.12

All good, and much faster. Happy surfing.