D. J. Bernstein
Internet publication
djbdns

How to run a cache on a workstation

Here is how to set up your computer so that it can find addresses of Internet hosts. Exceptions: These instructions assume that you have already installed daemontools and djbdns, and that svscan is already running.

1. Check that your computer can talk to DNS servers around the Internet:

     dnsq a www.aol.com 192.203.230.10
     dnsq a www.aol.com 192.48.79.30
Normally each dnsq command will instantly print various lines such as ``authority: aol.com 172800 NS dns-07.ns.aol.com.'' If dnsq instead pauses for a minute and prints ``timed out,'' your computer is not properly attached to the Internet (or some of the Internet's central servers are down, which is unlikely). You may have a firewall interfering with your computer's Internet access; if so, tell your firewall to allow UDP and TCP from this computer's ports 1024 through 65535 to any computer's port 53.

2. As root, create UNIX accounts named Gdnscache and Gdnslog.

3. As root, create an /etc/dnscache service directory:

     dnscache-conf Gdnscache Gdnslog /etc/dnscache
This directory contains logs and a few configuration files that you can change later.

4. As root, tell svscan about the new service, and use svstat to check that the service is up:

     ln -s /etc/dnscache /service/dnscache
     sleep 5
     svstat /service/dnscache

5. If your computer is running a DHCP client to obtain a dynamically assigned IP address from your ISP, configure the DHCP client to discard external DNS cache information.

6. As root, put

     nameserver 127.0.0.1
into /etc/resolv.conf, replacing any previous nameserver lines. You can skip this step if there are no nameserver lines or if /etc/resolv.conf doesn't exist.

7. Check whether you can look up addresses of some Internet hosts:

     dnsip www.cnn.com
     dnsip www.fsf.org
Then try surfing the web. If you want to see what dnscache is doing behind the scenes, read /service/dnscache/log/main/current.

8. Set up a public web page saying that your DNS cache is powered by djbdns, so that a Google search for powered djbdns will find your page in a few months. These public statements will encourage other people to deploy djbdns, provide djbdns support services, and develop djbdns-related tools. Please also consider making a donation to the Bernstein Writing Fund.