Walker News

How To Setup TinyDNS Server In 3 Minutes

Last weekend was my first time to setup and configure DNS server for a small office network with hundred units of networked computers. As usual, due to cost factor, the management decides to run an open-source DNS daemon on an aging Intel-based PC with Red Hat Linux 9.

After searching for some information, I decided to deploy djbdns (a.k.a tinydns) – a tiny, powerful, open-source DNS daemon of Dan Bernstein.

Almost one week of monitoring, the djbdns / tinydns server performance is quite acceptable! So, I take this opportunity to write out my so-called summarized version of djbdns / tinydns setup guide for quick reference.

I can confirm that this guide will take 3 minutes (more or less) to setup a DNS server for an internal network of any size, by using Dan Bernstein’s djbdns / tinydns daemon.
Before proceed to djbdns / tinydns installation steps, please download daemontools-0.76.tar.gz and djbdns-1.05.tar.gz from Dan Bernstein’s official site. Alternative download of djbdns / tinydns and daemontools from WalkerNews.net Download Center (md5 checksum printed on homepage).

Assumption for these “3-minutes djbdns / tinydns setup guide”:
  • All the djbdns / tinydns compilation and setup are done with root user ID. Try to avoid using sudo command for simplicity,
  • djbdns / tinydns daemon is running on Red Hat Linux 9 with IP address (non-public, private IP of the internal network)
How to compile and install daemontools?
Create the package installation directory with 1755 permission:
mkdir -p /package
chmod 1755 /package

Copy daemontools-0.76.tar.gz into /package directory and untar the gzipped source code:
tar -zxvpf daemontools-0.76.tar.gz
cd admin/daemontools-0.76

Fix daemontools compilation problem on latest version of glibc package:

vi src/error.h to replace extern int errno; with #include <errno.h>

Compile and install daemontools:

Once the daemontools compilation completed successfully, you should have seen these last few lines:

Copying commands into ./command…
Creating symbolic link daemontools -> daemontools-0.76…
Making command links in /command…
Making compatibility links in /usr/local/bin…
Creating /service…
Adding svscanboot to inittab…
init should start svscan now

Execute command ps -elf | grep svscan should confirm that /bin/sh /command/svscanboot and svscan /service are running too.
How to compile and install djbdns / tinydns?
Copy djbdns-1.05.tar.gz into /package directory and un-tar the gzipped source code:
tar -zxvpf djbdns-1.05.tar.gz
cd /package/djbdns-1.05

Fix djbdns / tinydns compilation problem on latest version of glibc package:

vi error.h to replace extern int errno; with #include <errno.h>

Compile and install djbdns server:
make setup check
Configure djbdns / tinydns server
Create user account to run tinydns service and logging facility:
/usr/sbin/useradd -s /bin/false tinydns
/usr/sbin/useradd -s /bin/false dnslog

Configure tinydns service with the bundled tinydns-conf utility:
tinydns-conf tinydns dnslog /etc/tinydns

The tinydns-conf utility will configure tinydns user account to run tinydns service, dnslog user account to run DNS logging facility, creates /etc/tinydns directory and defines that the tinydns service will listen on the server IP address (

Create symbolic link of /etc/tinydns to /service directory so that the svscan of daemontools will start up tinydns service and continue monitor the states:
ln -s /etc/tinydns /service

To confirm the tinydns service is running:
svstat /service/tinydns

Alternative, you can use netstat or lsof command to confirm the UDP port 53 (domain service port as per RFC-1035) has been opened by djbdns / tinydns:
netstat -tulpa | grep domain
lsof -i | grep domain

Now, it’s time to maintain the hostname-IP information of networked computers to djbdns / tinydns daemon:
cd /service/tinydns/root
vi data

and insert the djbdns / tinydns server IP as the first record:

Subsequently, add hostname-IP of other networked computers into this ASCII text file. For example,

to add hostname-IP of blog.walkernews.net (the djbdns / tinydns server itself) and download.walkernews.net (just another internal networked host).

After save and exit the /service/tinydns/root/data file, type make command (must be done inside /service/tinydns/root directory) to “compile” the /service/tinydns/root/data to /service/tinydns/root/data.cdb (cdb is a custom database of the author of djbdns), which is used by the daemon to resolve hostname-IP requests.

That’s all done for the DNS server setup! You can proceed to configure DNS setting of networked computers to resolve hostname-IP address with djbdns / tinydns, i.e.
Red Hat Linux and most Linux distribution
Add or update the client’s DNS setting:
vi /etc/resolv.conf

with at least these two simple lines:
search walkernews.net

After save and exit the /etc/resolv.conf file, the Linux networking components should able to resolve a given hostname by referring to DNS server at The search walkernews.net will tell Linux to automatically complete FQDN format for a given hostname. For example, ping blog is equal to blog.walkernews.net.
Windows 2000, Windows XP, Windows 2003, Windows Vista
Configure Windows Vista DNS setting to refer to djbdns / tinydns server.Right-click the Local Area Network connection and click on the Properties to bring up Local Area Connection Properties dialog box,

Select Internet Protocol Version 4 (TCP/IPv4) and click on the Properties button to bring up Internet Protocol Version 4 (TCP/IPv4) Properties dialog box,

Click on the Advanced button to bring up Advanced TCP/IP Settings dialog box,

Click on the DNS tab and enter the djbdns / tinydns IP address as of following snapshot:

Configure Windows Vista DNS setting to refer to djbdns / tinydns server.

Credit of the original djbdns / tinydns and daemontools setup guide that I’ve referred to.

Custom Search

  1. How To Setup Multiple Virtual Hosts In Apache – Walker News 28-10-07@23:54

    […] the DNS server to resolve both http://www.walkernews.net and http://www.example.com to one IP address, i.e. in […]

  2. Car Broker 13-11-07@19:19

    There is an error near the top where it says:

    Copy djbdns-1.05.tar.gz into /package directory and untar the gzipped source code:

    tar -zxvpf djbdns-1.05.tar.gz
    cd admin/daemontools-0.76

    It should read:

    Copy daemontools-0.76.tar.gz into /package directory and untar the gzipped source code:

    tar -zxvpf daemontools-0.76.tar.gz
    cd admin/daemontools-0.76

    Also, can u tell us what

    /usr/sbin/useradd –s /bin/false tinydns
    /usr/sbin/useradd –s /bin/false dnslog

    are supposed to do? I mean, I am looking for simple instructions (for a simple mind) and those don’t actually do anything except show usage help.

  3. Car Broker 13-11-07@19:22

    I take back the last comment about /usr/sbin/useradd –s /bin/false tinydns etc. because I notice when I copy it to Putty, the -s turns into .s for some reason.

    Sorry – and thanks for simple instructions (although the typo at the top threw me for a few minutes)

  4. Walker 14-11-07@00:06

    Hi Car Broker, thank you very much to correct my typo mistake.

    I’m really appreciate it and make the correction just now.

  5. Brian 04-05-10@17:11

    Awesome! I’m very appreciate this article! It’s very useful ;)
    Thanks for your sharing~

  6. Joe Wein 20-12-10@15:18

    There is a problem with some dashes in the instructions, because the “-s” hyphen was 0x96, 0x73, not 0x2D, 0x73. It’s probably the blogging software. I reentered the following with hyphens, but perhaps it will be broken again:

    /usr/sbin/useradd -s /bin/false tinydns
    /usr/sbin/useradd -s /bin/false dnslog
    ln -s /etc/tinydns /service

    *** Edited by Walker ***
    Thanks for the note!

  7. Joe Wein 20-12-10@15:57

    Thanks for editing the comment. Could you please also fix up the -s in the useradd commands in the article, as those are still broken and not everybody reads the comments before trying the steps in the article.

    Great article, BTW! I found it after not being able to install tinydns under Debian squeeze (6.0) using apt-get and decided to install from source code instead.

  8. Walker 20-12-10@16:05

    Yes, just done with correction on article too.
    Glad to know you find it useful :)

  9. Sebastian 22-07-13@15:33

    You can use dbndns from sid …
    installs on squeeze without problems.

    Unfortunately, doesn’t yet work for me … query is received (log/main/current shows it), but client times out (even on same machine, no firewall).

  10. Stewart 07-10-13@07:12

    I’ve read several good stuff here. Definitely value bookmarking for revisiting. I wonder how much effort you place to create this type of magnificent informative website.

2018  •  Privacy Policy