How do I create a secondary djbdns dns name server to resolve names if primary went down?
You can easily create secondary dns server using djbdns. Type the following commands to install secondary DNS server on FreeBSD server itself (type all the following commands on ns2.nixcraft.in):
ns2.nixcraft.in Secondary NameServer Installation and Configuration
Install djbdns:
# portsnap fetch update
# cd /usr/ports/dns/djbdns
# make install clean && rehash
Create users and required directories:
# pw groupadd dnsusers
# pw useradd tinydns -s /bin/nologin -G dnsusers
# pw useradd dnslog -s /bin/nologin -G dnsusers
# pw useradd axfrdns -s /bin/nologin -G dnsusers
# mkdir /var/service/
# echo 'svscan_enable="YES"' >> /etc/rc.conf
# /usr/local/etc/rc.d/svscan.sh start
Create Directory For Your Zone File
You need to create /var/ns2.nixcraft.in/ as follows:
# mkdir /var/ns2.nixcraft.in
# tinydns-conf tinydns dnslog /var/ns2.nixcraft.in 203.51.2.1
# ln -s /var/ns2.nixcraft.in /var/service/
# sockstat -4 -p 53
Now, your secondary tinydns server is running.
How Do I Replicate My DNS Data From ns1.nixcraft.in (first tinydns server)?
You have two options here as follows:
Replicating Your DNS Data Using axfrDNS Program
axfrdns bind to TCP port # 53. It reads a zone-transfer request in DNS-over-TCP format from its standard input, and responds with locally configured information. This program is useful to talk with external dns servers such as BIND. Using tcp client one can request a zone-transfer request for secondary tinydns. It is also useful to answer queries on TCP port # 53. Usually most client will use UDP port. See how to setup axfrdns on primary name server to accept a zone-transfer requests.
Replicating Your DNS Data (ns1.nixcraft.in) Using rsync or scp
You can just copy the generated data.cdb to the second tinydns name server using rsync or scp. This is preferred method when you just want to talk between your own two tindydns servers. Simply use scp command as follows to copy data.cdb from primary name server ns1.nixcraft.in:
# scp user@ns1.nixcraft.in:/var/ns1.nixcraft.in/root/data.cdb /var/ns2.nixcraft.in/root/
You can automate this procedure from ns1.nixcraft.in itself. Login to your primary name server and cd to /var/ns1.nixcraft.in/root
# cd /var/ns1.nixcraft.in/root
Open Makefile file, enter:
# vi Makefile
Update file as follows (to avoid password prompt setup ssh-key based login between ns1.nixcraft.in and ns2.nixcraft.in):
remote: data.cdb /usr/local/bin/rsync -az -e ssh data.cdb user@ns2.nixcraft.in:/var/ns1.nixcraft.in/root/data.cdb data.cdb: data /usr/local/bin/tinydns-data
Save and close the file. Finally, update Makefile on ns2.nixcraft.in as follows:
# cd /var/ns2.nixcraft.in/root
# vi Makefile
Append the following line protects data.cdb by stopping make:
# echo "foo" > Makefile
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop












{ 0 comments… add one now }