Table of Contents
No liability for the contents of this document and the usage of the described software can be accepted. Use the software, concepts, examples and information at your own risk. There may be errors and inaccuracies, that could be damaging to your system. Proceed with caution, and although this is highly unlikely, the author(s) do not take any responsibility.
All copyrights are held by their respective owners, unless specifically noted otherwise. Use of a term in this document should not be regarded as affecting the validity of any trademark or service mark. Naming of particular products or brands should not be seen as endorsements.
Copyright (c) 2006-2007 by Frank Bergmann
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License ([GFDL]) , Version 1.2 published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and with no Back-Cover Texts.
For their software and the inspiration I received by their work I would like to thank D. J. Bernstein (djb) and Felix Leitner (fefe).
The following typographic and usage conventions occur in this text:
Table 1. Typographic and usage conventions
|“Quoted text”||Quotes from people, quoted computer output.|
|Literal computer input and output captured from the terminal.|
|command||Name of a command that can be entered on the command line.|
|Option to a command, as in “the |
|Parameter to a command, as in “read
|Name of a file or directory, for example “Change to the
|The author||Click-able link to an external web resource.|
|GNU FDL ([GFDL])||A Reference to an external source|
|DYNDNS||A glossary keyword|
Thanks to Machtelt “Tille” Garrels for this list of conventions.
Running my own nameservers (in one subnet) and having access to a server in a different subnet I thought about a DYNDNS solution. For a long time I used software by D. J. Bernstein including his software suite djbdns ([DJBDNS]) with its easy-to-use, small, fast, secure and reliable DNS-server tinydns. Therefore I wanted a DYNDNS solution with tinydns and as simple as tinydns.
To realize DYNDNS with
you have to (continously) alter its database, the file
Using ed, sed, perl
or something similar would be a chaotic solution,
no easy task to implement and can cause data loss.
It seemed more easy to create the file
itself acts as the database for
and what database should be the database for this?
Software engineers like DJB have shown that
the filesystem and the files can be a easy-to-use database.
With this idea in mind I started to write the main script
This script collects data from a file hierarchy (file contents and filenames) and creates a new
file. It's easy to use a webserver script to write DYNDNS data in this file hierarchy,
it's easy to get an overview or search in the nameserver data and it's very easy i.e.
to move a www-domain from one IP-address zo a different address:
[me@dns ip]mv 184.108.40.206/aliases/mydom.org 220.127.116.11/aliases/
The following text is taken from http://cr.yp.to/:
It works for Lycos. It works for citysearch.com. It works for pobox.com. It works for 1.85 million more .com's. It works for several of the Internet's largest domain-hosting companies: directNIC, MyDomain/NamesDirect, Interland, Dotster, Easyspace, Namezero, Netfirms, and Rackspace Managed Hosting. It'll work for you too.
djbdns is a collection of Domain Name System tools. It includes software for all the fundamental DNS operations:
DNS cache: finding addresses of Internet hosts. When a browser wants to contact www.hotwired.com, it first asks a DNS cache, such as djbdns's dnscache, to find the IP address of www.hotwired.com. Internet service providers run dnscache to find IP addresses requested by their customers. If you're running a home computer or a workstation, you can run your own dnscache to speed up your web browsing.
DNS server: publishing addresses of Internet hosts. The IP address of www.hotwired.com is published by HotWired's DNS servers. djbdns includes a general-purpose DNS server, tinydns; network administrators run tinydns to publish the IP addresses of their computers. djbdns also includes special-purpose servers for publishing DNS walls and RBLs.
DNS client: talking to a DNS cache. djbdns includes a DNS client C library and several command-line DNS client utilities. Programmers use these tools to send requests to DNS caches.
djbdns also includes several DNS debugging tools, notably dnstrace, which administrators use to diagnose misconfigured remote servers.
The djbdns package includes three servers that publish local host information: tinydns, walldns, and rbldns. Every aspect of configuration was rethought from the perspective of an overworked administrator who has better things to do than play with DNS.
tinydns handles basic DNS service. The tinydns-data file format combines the flexibility of zone files with the convenience of modern zone-building tools. Host information is stored in one file. PTR records are handled automatically. Changes can be scheduled in advance, with TTLs handled automatically.
tinydns has several load-balancing features. It automatically selects a random set of 8 servers from a cluster of any size. It allows easy removal of dead servers by external monitoring tools. It also supports client differentiation, checking the client's IP address and choosing one of several clusters accordingly.
Databases for tinydns and rbldns are compiled into cdb format. The servers start responding immediately, even if the database is a gigabyte or more. (In contrast: BIND cannot answer questions until it has loaded all your data into memory.)
One site reported tinydns answering 6000 queries per second on a dual Pentium III-1000 using 40% of one CPU. That's real queries, not peak performance in lab tests.
While a new database is being compiled, the servers continue to answer queries from the old database. There is no gap in DNS service when the new database is finished. The old database is left in place if anything goes wrong.
Database compilation is very fast. One site reported tinydns-data taking under a minute on a Pentium III-550 to create a 350-megabyte data.cdb covering almost 300000 domains.
The following text is taken from http://cr.yp.to/:
daemontools ([DAEMONT]) is a collection of tools for managing UNIX services.
supervise monitors a service. It starts the service and restarts the service if it dies. Setting up a new service is easy: all supervise needs is a directory with a run script that runs the service.
multilog saves error messages to one or more logs. It optionally timestamps each line and, for each log, includes or excludes lines matching specified patterns. It automatically rotates logs to limit the amount of disk space used. If the disk fills up, it pauses and tries again, without losing any data.
txdyn is mainly a script and two optional programs. The script creates a data file for tinydns. The optional programs are a small "webserver" and a tool which launches the script periodically by calling make.
The base directory for the script create-data.sh is the root-subdirectory of the tinydns-service:
The following description uses file and directory paths relative to this base directory.
the main script
its main target just calls ./create-data.sh
the directory holding all nameserver data to create the data file for tinydns
contains an ordered list of all IP addresses resolved by this nameserver
ordered list of domains with nameservers (e.g. tuxad.net which has ns1.tuxad.net and ns2.tuxad.net)
base config dir for IP-address 10.1.1.1
contains hostname for the host with this IP#
directory holding all mx hosts for this IP#
filename is mx hostname, content specifies domain served by this mx host
DNS MTAMARK, contains 1 if server acts as mail-server
every file in this directory specifies an alias
an alias entry
contains nameservers (structure like mx dir)
name is host, content are domains
holds all domains with dyndns-names
content's first line is IP#, 2nd line is time-to-live in minutes
creates a file
with the information it collects from the directory
like it's described in
If the nameserver data in the
directory will change frequently
must be started periodically
in short intervals.
This is the case if you want to use DYNDNS.
One possible solution is a cronjob, another solution is to use
which will call the script by
more often than a minutely cronjob.
creates a PID-file in the
directory to avoid multiple running instances.
does not create a new
if there were no changes of nameserver
data in the
tinydnsupdate substitutes a cronjob for periodically calling create-data.sh. If even a minutely cronjob is not frequently enough for calling create-data.sh then this small helper tool can be used.
reads the environment variable
into this directory and calls
forever with breaks of 10 seconds.
Its working directory must be the
directory which contains
is designed to run under
You must create a directory for it,
containing the tool itself,
a daemontools run script and an
with the file
Here's an example:
$ cd /service/tinydns/root/tinydnsupdate/ $ ls -l total 32 dr-xr-xr-x 2 tinydns tinydns 4096 Apr 9 14:22 env -r-xr-xr-x 1 tinydns tinydns 62 Apr 9 14:22 run drwx------ 2 tinydns tinydns 4096 Apr 9 14:22 supervise -r-xr-xr-x 1 tinydns tinydns 1252 Apr 9 14:22 tinydnsupdate $ cat env/TINYDNS_ROOT /service/tinydns/root $ cat run #!/bin/sh exec setuidgid tinydns envdir ./env ./tinydnsupdate
As the example shows the directory can be set up in the tinydns
This tool must not run with root rights. It should be run as the user who may create the
To start it you must create a symlink in the
to this directory:
$ cd /service $ ln -s tinydns/root/tinydnsupdate
There are a few requirements to install/run the txdyn software:
base environment with bash and sed
make (with pattern rules support)
default required, but actually optional:
Here's a sample installation for a quick start.
Example 1. Installation Instructions
Unpack the archive:
tar xzf txdyn-0.5.tgz
Step into txdyn/src-directory:
Call make and specify the IP-addresses of your master and one or more slave nameservers:
make MASTER=10.1.1.1 SLAVES="10.2.2.1 10.3.3.1"
Do a make install as root:
su -c 'make MASTER=10.1.1.1 SLAVES="10.2.2.1 10.3.3.1" install'
If this fails and an error about a missing user is displayed then install the user accounts and do it again:
su -c 'make install-users' su -c 'make MASTER=10.1.1.1 SLAVES="10.2.2.1 10.3.3.1" install'
the name of a company and also a commonly used term for dynamic name service:
“ Dynamic DNS is a system which allows the domain name data held in a name server to be updated in real time. The most common use for this is in allowing an Internet domain name to be assigned to a computer with a varying (dynamic) IP address. This makes it possible for other sites on the Internet to establish connections to the machine without needing to track the IP address themselves. A common use is for running server software on a computer that has a dynamic IP address, as is the case with many consumer Internet service providers. ” (Wikipedia)