Before installing djbdns, you must have daemontools and ucspi-tcp installed.

Installation Edit

cd /usr/src
tar xpzf djbdns-1.05.tar.gz
cd djbdns-1.05
make setup check

chmod 0755 /usr/local /usr/local/bin

The chmod is because hier.c is modifying /usr/local and /usr/local/bin to 02755 and /etc/security then complaints.

Configuration Edit

dnscache: Edit

groupadd -g 5000 nofiles
useradd -u 5010 -g nofiles -d /var/dnscache -s /sbin/nologin dnscache
useradd -u 5011 -g nofiles -d /var/dnscache/log -s /sbin/nologin dnslog

dnscache-conf dnscache dnslog /var/dnscache
cd /var/dnscache
dd if=/dev/srandom of=seed bs=128 count=1
chown -R dnscache:nofiles .
chown -R dnslog log
touch /var/dnscache/root/ip/192.168.0

ln -s /var/dnscache /service

Where is the IP address where you will run the DNS cache. (with dnscache-conf)

You allow the entire 192.168.0 network to access your DNS cache. (with touch)

Patches Edit

Dumpcache: Edit

As dnscache works only on memory it will discard all it's content of cache data upon reboot. This is a patch to djbdns that will enable you to dump the cache from a running dnscache, or load a previously dumped cache at startup.
It is useful when you have an OpenBSD box that you shutdown daily and you want to preserve all the dns resolved catches that djbdns have done.

Download the patch from
Outside of your djbdns-1.05 directory apply the patch, stop dnscache, compile and install:

patch -p0 < patch-dnscache-dumpcache-v4.txt
svc -d /service/dnscache
cd djbdns-1.05
make setup check

Configure some dumpcache options and restart dnscache:

cd /service/dnscache/env
echo dump/dumpcache > DUMPCACHE
echo dump/dumpcache.tmp > DUMPCACHETMP
echo dump/dumpcache > SLURPCACHE
svc -t /service/dnscache

You can configure the logs to show only the lines you want. Here is an example of /service/dnscache/log/run:

exec setuidgid dnslog multilog t '-*' '+* stats *' '+* slurp *' \
 '+* dump *' '+* tcp*' '+* cachesize *' '+* starting' ./main

You need to tell OpenBSD to dump the cache to the file upon reboot or shutdown. Here is an example of /etc/rc.shutdown:

# dump djbdns cache:
/usr/local/bin/svc -a /service/dnscachex

At startup dnscache will automatically read the file in SLURPCACHE and load its contents.

Links Edit

References Edit

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.