Installing the Wyse 2: dnrd
The new Wyse machine should serve as a caching DNS for the internal network. This will enable us to resolve host names on the internet (e.g. www.google.com) and local hostnames (e.g. localhostname.earth). My old router used dnrd to accomplish this, so I will use dnrd again. You could use a full blown DNS server, such as bind but bind has always suffered some security issues and is harder to configure (but not impossible).
So, first we need to download and extract dnrd:
Next, install a compiler:
Next, configure the package:
Compile and install the package:
Create a startup script (/etc/init.d/dnrd)
Add a user for dnrd
Configure dnrd; create and edit /usr/local/etc/dnrd/master
Start dnrd using the script we created earlier:
Test your nameserver:
As you can see, dnrd is able to resolve the earth domain. Adding additional hosts from your local network is accomplished by adding additional entries in the /usr/local/etc/dnrd/master file. All you need to do is maintain one single configuration file. Configuring bind to do this, requires a lot more additional steps and configuration files.
Finally, we need to make sure dnrd starts when the system is booted:
So, first we need to download and extract dnrd:
# wget http://downloads.sourceforge.net/dnrd/dnrd-2.20.3.tar.gz
# tar xvfz dnrd-2.20.3.tar.gz
Next, install a compiler:
# apt-get install gcc
# apt-get install g++
# apt-get install make
Next, configure the package:
# ./configure
Compile and install the package:
# make
# make install
Create a startup script (/etc/init.d/dnrd)
#! /bin/sh
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Domain Name Relay Daemon"
NAME=dnrd
DAEMON=/usr/local/sbin/$NAME
PIDFILE=/var/run/$NAME.pid
OPTIONS="-s 195.130.131.10 -s 195.130.130.5 -a 192.168.1.254"
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
#
# Function that starts the daemon/service.
#
d_start() {
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--exec $DAEMON -- $OPTIONS
}
#
# Function that stops the daemon/service.
#
d_stop() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
--name $NAME
}
#
# Function that sends a SIGHUP to the daemon/service.
#
d_reload() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
--name $NAME --signal 1
}
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;
restart|force-reload)
echo -n "Restarting $DESC: $NAME"
d_stop
sleep 1
d_start
echo "."
;;
*)
# echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
Add a user for dnrd
# adduser --system dnrd
Configure dnrd; create and edit /usr/local/etc/dnrd/master
domain earth
192.168.1.1 localhostname
192.168.1.254 firewyse
Start dnrd using the script we created earlier:
/etc/init.d/dnrd
Test your nameserver:
# nslookup firewyse
Server: 192.168.1.254
Address: 192.168.1.254#53
Non-authoritative answer:
Name: firewyse.earth
Address: 192.168.1.254
As you can see, dnrd is able to resolve the earth domain. Adding additional hosts from your local network is accomplished by adding additional entries in the /usr/local/etc/dnrd/master file. All you need to do is maintain one single configuration file. Configuring bind to do this, requires a lot more additional steps and configuration files.
Finally, we need to make sure dnrd starts when the system is booted:
# update-rc.d dnrd defaults
Adding system startup for /etc/init.d/dnrd ...
/etc/rc0.d/K20dnrd -> ../init.d/dnrd
/etc/rc1.d/K20dnrd -> ../init.d/dnrd
/etc/rc6.d/K20dnrd -> ../init.d/dnrd
/etc/rc2.d/S20dnrd -> ../init.d/dnrd
/etc/rc3.d/S20dnrd -> ../init.d/dnrd
/etc/rc4.d/S20dnrd -> ../init.d/dnrd
/etc/rc5.d/S20dnrd -> ../init.d/dnrd
Comments