Setup a DNS server with tinydns
From TekPedia
[edit] Installation
This guide is specific for Gentoo, but it should work for most distributions
A DNS or Domain Name Server is used to resolve hosts IP's using the given domain address, the objective of that is not trying to remember ip addresses like 64.233.187.99 instead of that we just have to remember the easier google.com, that said, name servers were designed for humans
There are 2 main players on the DNS opensource “market”, BIND and djbdns, the later more acclaimed for being easier and faster to configure.
first of all lets emerge svscan so if our dns server dies, it starts again automatically
emerge supervise-scripts
we add svscan to the default run level so it starts every time the server reboots
eselect rc add svscan default
and finally start the service
eselect rc start svscan
after feeling secure with a service watcher, we continue emerging djbdns
emerge djbdns
You may also want the manpages
emerge djbdns-man
[edit] Configuration
the first thing we need to do is to make tinydns bind to the ip address of the server we are installing the service on, with the users tinydns and dnslog that were created during the installation, replace 1.2.3.4 with your IP address!
tinydns-conf tinydns dnslog /etc/tinydns 1.2.3.4
and then we can create a soft link so svscan takes care of our name server
ln -s /etc/tinydns /service/tinydns
djbdns has a dnscache server feature, but that its most usefull when having individual host to take care of, now we are ignoring that since im using a single dns server for my VPS account
so we now are ready to add a simple name to your server, change to the following directory:
cd /service/tinydns/root
and then add your domain and bind ip, and execute make so the changes take effect
./add-ns example.com 1.2.3.4 make
thats a clean example, but maybe you want more, surely you will, you can edit the /service/tinydns/root/data file as your wish to make your desired configuration, like the email server, here is my config so you can take something as a base:
Zpablasso.com:pablasso.com.:pablasso.com.:2005100111:28800:7200:604800:3600:3600 #name server &pablasso.com::ns1.pablasso.com.:3600 &pablasso.com::ns2.pablasso.com.:3600 #full domain =pablasso.com:64.79.194.86:3600 # MX record (mail) pablasso.com:64.79.194.86:a::60 #aditional +mail.pablasso.com:64.79.194.86:3600 +ns1.pablasso.com:64.79.194.86:3600 +ns2.pablasso.com:64.79.194.86:3600 +www.pablasso.com:64.79.194.86:3600
please remember to execute make after making changes
so now you're ready to go, you can go to your favorite domain reseller and point your domain to your new server, no more depending on other people's services, you have your own dns to mess up now!
You may also want to look at HOWTO: Add SPF Record to domain and check your zone with DNS Report
