Now we will setup the tinydns authoritative nameserver. The authoritative nameserver is going to contain zone files for all domains which you wish to handle. In other words, we're about to set your DNS server! Once the zone entry for a domain in entered into tinydns, you can then point that domain, via your registrar, toward your nameserver and it will direct requests (web, mx, etc.) wherever you want them to go!
Registering your nameservers
The first thing you need to do, before we worry about deploying tinydns, is to register your nameservers. After all, it won't do any good to have a DNS server with no registered addresses. If you're smart, you should have done this well before reading the guide, but if you haven't here's you chance.
First, you'll want to select the 2 IP addresses that you wish to use for each of your nameservers. For this example, let's say that I have bound the following 2 IP addresses to my server:
OK, binding them to your server is easy enough. If you don't know how to do that, you're really in over your head right now. So the next step is deciding what names you will assign to these IP addresses. Nameserver names are pretty standard in format. Usually using something like "ns1.yourdomain.com" and "ns2.yourdomain.com" will do just fine, but they can really be anything you like. So, for this example, let's say my domain is djbdnsrocks.org. With the 2 IP addresses above, I now intend to register 2 nameservers:
Sounds easy enough, right. Well, it is. Registering nameserver is required, but simple. Domain registrars WILL NOT let you point a domain to any nameservers that are not registered. Fortunately, most (if not all) domain registrars give the domain administrator the ability to easily register nameservers for any domain that they own. The process WILL VARY from registrar to registrar, but overall it's the same idea. I personally use godaddy.com to register my domains. In the godaddy.com domain administration panel, there is an area where you can register nameservers for a domain. You simple tell them the name of the nameservers you want to register and the IP addresses to which they will point. It is VERY IMPORTANT that you make sure that the 2 IP addresses you intend to use are functional and that they resolve to a working server. So, for djbdnsrocks.org, I would register the following 2 nameservers:
Once you complete the registration process, it generally takes around 24 hours for the new nameservers' registration to be active and functional.Once that's done, you can now focus on deploying tinydns on your server and making those nameservers actually do something!
The first thing you'll want to do is create the needed users on your system that will enable your DNS server to function correctly. Lucky for you, I've created some scripts to do that...
For Redhat and most other Linux systems:
For FreeBSD systems:
Next, we will create the core of the first tinydns server. We will create a series of scripts and folders and it is here where all the zones and other configs will live. Fortunately, there are ready made scripts that do all the work for us. Remember, that since we are creating 2 nameservers, we're going to do this twice.
So let's create the first nameserver. In this example, I'm creating the first tinydns server for the IP address that will serve ns1.djbdnsrocks.org
/usr/local/bin/tinydns-conf tinydns dnslog /etc/tinydns 220.127.116.11
Viola! If you take a look, there will now be an /etc/tinydns folder with lots of crazy files and scripts in it. Don't worry about them now, however. We'll go over them later.
Now, let's create our second tinydns server, which in the example is for the IP address serving ns2.djbdnsrocks.org
/usr/local/bin/tinydns-conf tinydns dnslog /etc/tinydns2 18.104.22.168
Alright, now you should have an exact clone of the first tinydns server at /etc/tinydns2. That wasn't so bad, now was it? Now your 2 tinydns servers are installed and ready to be fired up. Granted, they don't contain any zone entries for any domains yet, but we'll get to that in a bit.
Starting these 2 nameservers simply means adding them to the daemontools service directory. If you're familiar with daemontools, you know how easy this is. But if not, don't worry, because guess what? It's easy. Well, it's easy as long as you've already installed daemontools and ucspi-tcp.
First, let's crank up the 1st nameserver:
ln -s /etc/tinydns /service
And now the 2nd...
ln -s /etc/tinydns2 /service
OK, that's it! They should now be up and running. If you run a "ps -aux" (or similar) command on your server you should now see the 2 nameservers running. It should look similar this:
root 1738 0.0 0.0 1384 284 ? S Sep08 0:00 supervise tinydns
root 1739 0.0 0.0 1372 280 ? S Sep08 0:00 supervise log
root 1742 0.0 0.0 1368 280 ? S Sep08 0:00 supervise tinydns2
root 1743 0.0 0.0 1372 284 ? S Sep08 0:00 supervise log
tinydns 1749 0.0 0.0 1632 348 ? S Sep08 0:10 /usr/local/bin/tinydns
tinydns 1760 0.0 0.0 1620 344 ? S Sep08 0:09 /usr/local/bin/tinydns
root 1731 0.0 0.0 1364 232 ? S Sep08 0:00 readproctitle service errors: .......................................
If the "readproctitle service errors" line is clear, as above, you are all set. If it shows errors, you will need to troubleshoot those errors. Reading each nameserver's logs at /etc/tinydns/log/main/current and /etc/tinydns2/log/main/current can help track down an error a lot of the time. Most errors with tinydns are "usually", in my experience, related to bad file permissions or ownership settings.
OK, so your 2 tinydns nameservers are now up and running! In the next step of the install, we are going to divert from tinydns for a few minutes so that we can set up an internal caching nameserver on our server. Then, after that, we'll return to tinydns and install the Vegadns web based DNS control panel. From there, you can start adding domains to your nameserver!
Proceed to step 5