Bernstein's DNS implementation rocks, and using its cache on a laptop circumvents a lot of the hassles one finds with badly setup DNS forwarders on commodity routers. Except that DJB has a healthy paranoia and his licensing for djbdns means that binary distributions have to jump through hurdles to support the licensing. Add to that his predilection for platforming, so that to use djbdns as documented you need to install daemontools and ucspi-tcp as well.
Well, I just want to run djbdns out of inittab without any of the other stuff. I just wrote a wrapper program to set up the environment that dnscache needs. To compile it and install it, first download and compile djbdns, then:
sudo dnscache-conf nobody nobody /etc/dnscache gcc -Wall dns_cached.c -o dns_cached sudo cp dns_cached /usr/local/bin/. echo p0:2345:respawn:/usr/local/bin/dns_cached | sudo tee -a /etc/inittab sudo /usr/local/bin/dns_cached /etc/dnscache
After the last command, you should see some environment variables set, and then djbdns stating that it's starting. Checking the output of netstat should show tcp and udp port 53 both bound, and you should see dnscache running in your machine's processlist. Now run a query against the local nameserver, e.g. " host x.org 127.0.0.1 " which should return an address.
Now, we just need to make 127.0.0.1 the permanent nameserver for this machine. The easy way to that is:
echo nameserver 127.0.0.1 | sudo tee /etc/resolv.conf chattr +i /etc/resolv.conf
/etc/resolv.conf is now immutable and our dhcp implementations won't change it anymore. Feel free to work within your distro's networking setup to support multiple DNS servers, if you feel like it. Regardless, you've just freed your laptop from the tyranny of sub-performant DNS setups.