dbjdns
An alternative to bind. Two daemons will be running to do DNS. dnscache performs lookup on non locally hosted records. tinydns perform lookups on locally hosted domains, and does not look up external addresses.In order to have djbdns function well in a private network with a private DNS, we need to work around the limitations.
- Run dnscache on external IP (for authorized subnet to query your DNS server)
- Run second dnscache on 127.0.0.1 (for the name server itself to resolve DNS)
- Run tinydns on second external IP (1.2.3.123)
- Instruct dnscache to query 1.2.3.123 for locally hosted domains
If you are planning on running djbdns in a public DNS server
- Run tinydns on the ns IP
- Run dnscache on localhost
Setting up djbdns in a private network
This server will be the dns server for your private network. In addition, it will host a private domain mydomain.com.Installing daemontools
Do a source install with errno patch.Installing dnbdjs
/usr/sbin/useradd -s /sbin/nologin -d /dev/null tinydns /usr/sbin/useradd -s /sbin/nologin -d /dev/null dnslog /usr/sbin/useradd -s /sbin/nologin -d /dev/null dnscache wget http://cr.yp.to/djbdns/djbdns-1.05.tar.gz tar zxvf djbdns-1.05.tar.gz cd djbdns-1.05 echo gcc -O2 -include /usr/include/errno.h > conf-cc make make setup check
Setting up dnscache
dnscache-conf dnscache dnslog /etc/dnscache 1.2.3.4 ln -s /etc/dnscache /service dnscache-conf dnscache dnslog /etc/dnscache-local 127.0.0.1 ln -s /etc/dnscache-local /service echo "nameserver 1.2.3.4" > /etc/resolv.conf rm -Rf /service/dnscache/env/supervise # allow host in the subnet to queries dnscache touch /etc/dnscache/root/ip/1.2.3 # ask dnscache to query tinydns for locally-hosted domains echo "1.2.3.123" > /service/dnscache/root/servers/mydomain.com echo "1.2.3.123" > /service/dnscache/root/servers/3.2.1.in-addr.arpa
Setting up tinydns
Because the default IP and localhost IP have been occupied by dnscache, we need to run tinydns on another IP address. This address will be queried by dnscache only./usr/local/bin/tinydns-conf tinydns dnslog /etc/tinydns 1.2.3.123 ln -s /etc/tinydns /service
Adding records for your domain
cd /etc/tinydns/root ./add-ns mydomain.com 1.2.3.4 ./add-ns 3.2.1.in-addr.arpa 1.2.3.4 ./add-host headland.mydomain.com 1.2.3.5 ./add-host precise.mydomain.com 1.2.3.6 ./add-alias www.mydomain.com 1.2.3.5 make
If you are looking for simple dnscache
pkg_add -r djbdns pw groupadd nofiles -g 800 pw useradd dnslog -u 810 -g 800 -c "Logging for dns" -d /usr/local/djbdns/ -s /sbin/nologin pw useradd dnscache -u 811 -g 800 -c "dnscache" -d /usr/local/djbdns/ -s /sbin/nologin dnscache-conf dnscache dnslog /var/dnscache 127.0.0.1 ln -s /var/dnscache /service/dnscache echo "nameserver 127.0.0.1" > /etc/resolv.conf
There are no comments on this page. [Add comment]