Running a Local Caching Name Server with BIND

You want to set up a local BIND caching name server for your LAN to speed up DNS lookups, which in turn will speed up all of your Internet services.



Install BIND on a Linux machine with a static IP address. Be sure you get the latest version. Don’t mess with older versions, as they are buggy and exploitable. After installation, you’ll have four configuration files to edit or create:

  • named.conf
  • named.root
  • zone.localhost
  • revp.127.0.0

Al of these files are in /var/named, except for /etc/named.conf. named.confis the standard name for BIND’s configuration file; all the others you can name to suit yourself. Here is a sample named.conf:

//BIND configuration file

//named.conf for caching server

options {

// where all zone files are

directory "/var/named";

// accept queries only from local subnet

listen-on {;;


allow-recursion {;;



zone "." IN {

type hint;

file "named.root";


// location of the zone file for localhost

zone "localhost" IN {

type master;

file "zone.localhost";

allow-update { none; };


// reverse pointer file for localhost

zone "" IN {

type master;

file "revp.127.0.0";

allow-update { none; };


Now add named.root.This is the master list of the root name servers; simply fetch the current version from, and put it in /var/named.

Now create zone.localhost:

; zone.localhost

; loopback/localhost zone file



$ORIGIN localhost.

@ IN SOA @ root (

1 ; Serial

8H ; Refresh

15M ; Retry

1W ; Expire

1D) ; Minimum TTL



Finally, create revp.127.0.0:

; revp.127.0.0

; reverse pointers for localhost




@ IN SOA localhost. root.localhost. (

1 ; serial

8H ; refresh

15M ; retry

1W ; expire

1D ) ; minimum

IN NS localhost.

1 IN PTR localhost.

Then start up BIND:

# /etc/init.d/named start

You now have a local caching name server. See this to learn how to connect client PCs to your caching server.


named is short for "name daemon."

BIND configuration files can grow and multiply like weeds, so using a naming convention like the one shown here will save your sanity. Zone files each start with "zone," and reverse pointer files start with "revp." You may call them anything you want, as long as you use a consistent naming scheme.

You can use each one of these sample files exactly as they are shown. The only change you might need to make is the listen-on directive in named.conf—be sure to use your own network IP addresses. Leave localhost exactly as it is shown, unless you’re using some exotic networking voodoo, in which case you already know what to do. Do not allow traffic from outside your network! There is no reason for you to supply caching services to the world.

The named.root filedoes not change very often. Check it every few months just for kicks. You may call it anything you like, as long as you record the filename in named.conf.

zone.localhost tells named that the address of localhost is

revp.127.0.0 does the opposite of zone.localhost—it tells named that the hostname associated with the IP address is localhost.