Personal tools
You are here: Home Hobbies Computers FreeBSD Jail: djbdns (dns server)

Jail: djbdns (dns server)

Install the djbdns package and configure as a dns server

Preface

This guide has been assembled from multiple web sites.  It's assumed you've already performed the installation of FreeBSD and created a jail (ie; EZJail).

Installation

Installation simply involves installing the djbdns with the default options configuration options:

cd /usr/ports/dns/dbjdns
make clean
make install
make clean

Configuration

The first step is to manually create the users as per the dbjdns instructions:

pw groupadd dns
pw useradd tinydns -s /bin/nologin
pw useradd dnslog -s /bin/nologin
pw groupmod dns -m tinydns,dnslog

The environment can now be created for the dns cache server using the user IDs just created above and the IP address of the jail itself.  Since this is a port I prefer to keep the data files in /usr/local.

tinydns-conf tinydns dnslog /usr/local/etc/tinydns 192.168.1.46

Now change to the /usr/local/etc/tinydns/root directory and add your '.' record,  any host/alias records, and run 'make' when done:

./add-ns kingsquarry.net 192.168.1.46
./add-ns 1.168.192.in-addr.arpa 192.168.1.46
./add-host rivendell.kingsquarry.net 192.168.1.46
./add-alias ns.kingsquarry.net 192.168.1.46
make

Configure svscan to find and automatically start our dns cache server by performing the following steps:

cd /var
mkdir service
cd service
ln -s /usr/local/etc/tinydns tinydns

Finally we need to enable and add the service directory parameters to the /etc/rc.conf file:

svscan_enable="YES"
svscan_servicedir="/var/service"

Startup

If everything is properly configured we can execute the following command to start our new dns server:

/usr/local/etc/rc.d/svscan.sh restart

Test

You'll need to edit your /etc/resolv.conf file to use your new dns server:

domain kingsquarry.net
nameserver 192.168.1.46

Now you can perform a dnsip lookup:

dns# dnsip ns.kingsquarry.net
192.168.1.46

 

Yes, it's great to have your own dns server but it's rather useless for most people.  You'll probably also want to install a dns cache server which can cache external results but also refer to your, possibly private, dns server.

Document Actions
« July 2010 »
July
SuMoTuWeThFrSa
123
45678910
11121314151617
18192021222324
25262728293031
Huntersville, NC Weather

Current Conditions
@

Temp :
Humidity :
Barometer :

Forecast