DJBDNS integration into H-Sphere
(DJBDNS vs. Bind)
- Introduction
- Requirements and restrictions
- Preparation
- Installation
- Creation database
- Files
- Uninstall
- Appendix A
Introduction
Many H-Sphere custommers wanted to install DJBDNS instead of Bind as DNS service. Now they have such possibility.
We introduce you djbdns_inst.sh script that can install/uninstall DJBDNS on H-Sphere DNS servers.
In Install mode:
- Disable Bind on H-Sphere DNS server;
- Move to backup standard H-Sphere DNS scripts;
- Install instead of them new scripts;
- Install DJBDNS into /hsphere/local/var/djbdns directory;
- Run TinyDNS and AxfrDNS processes.
In Uninstall mode:
- Stop DJBDNS processes;
- Remove DJBDNS directory and scripts;
- Restore H-Sphere DNS scripts from backup;
- Run Bind process.
Requirements and restrictions
Our script can install DJBDNS only on H-Sphere DNS servers.
Supported OSs:
Red Hat Linux release 7.x (r73)
Red Hat Enterprise Linux (res3)
CentOS release 3.x, 4.x (co31 and co42)
Trustix (trust)
For FreeBSD 6.1 users:
Conrad Hunziker III, NightSky Hosting, Inc. modified the djbdns_inst.sh script to accept freebsd as an os, install djbdns from ports, and then configure it to work with our scripts. Use djbdns_inst.freebsd.sh script instead of djbdns_inst.sh (not tested by root0.net yet).
If you have another OS you can try to install djbdns RPM for one of supported OS. Just use "-o" option.
Restrictions:
DJBDNS server will be working only on one IP. That is why don't use this script if you your DNS server is listening more IPs.
Preparation
DJBDNS store its data in database on master server and copy it to all slaves. That is why all H-Sphere DNS zones must to have only one master DNS before DJBDNS integration.
You need to setup master role for one of your DNS servers and slave for another in H-Sphere control panel. Then run PSoft DNSCreator java class with "-m rand" option, to recreate all DNS zones with same master server.
[root@cp ~]# su - cpanel
-bash-3.00$ java psoft.hsphere.tools.DNSCreator -m rand -dz
Installation
- Download djbdns_inst.sh script and run it without parameters to get help. See Example 1
- For istallation DJBDNS as master see Example 2. You can skip "-y" option if you have only one DNS server.
- For istallation DJBDNS as slave see Example 3
- Make sure that you have the following (djbdnsmake process only on master server) processes:
[root@cp djbdns]# ps axw | grep dns
29510 pts/2 S 0:00 /bin/sh /hsphere/local/var/djbdns/tinydns/root/djbdnsmake
29515 ? S 0:00 supervise tinydns
29517 ? S 0:00 supervise axfrdns
29519 ? S 0:00 /usr/local/bin/tinydns
29521 ? S 0:00 tcpserver -vDRHl0 -x tcp.cdb -- 192.168.1.102 53 /usr/local/bin/axfrdns
29566 pts/2 S 0:00 grep dns
[root@cp djbdns]#
- Create SSH keys on master DNS server and post them to all your slaves. Make sure that root from master server has access to all slave servers without password:
[root@cp djbdns]# ssh root@192.168.103.164
Last login: Sun Mar 26 19:46:01 2006 from cp
[root@ns2 ~]# exit
[root@cp djbdns]#
Now every time when DJBDNS database be updated, master server will copy new version to all slaves.
Creation database
H-Sphere has DNSCreator java class. Use it:
[root@cp ~]# su - cpanel
-bash-3.00$ java psoft.hsphere.tools.DNSCreator -m db -dz
It will create data.cdb file on master server and copy it on all slaves.
Make sure that you have correct (not 127.0.0.1) nameservers in /etc/resolv.conf files.
Wait 2-3 minutes.
Now you can test your new DNS servers with dig:
[root@cp ~]# dig yourdomain.com @yourdnsserver_ip
See Example 5
That is all. Congratulation.
Files
All DJBDNS files are located in /hsphere/local/var/djbdns directory
DJBDNS database /hsphere/local/var/djbdns/tinydns/root/data.cdb
TinyDNS (DNS server on 53 UDP port):
[root@cp djbdns]# /etc/init.d/tinydns
Usage: /etc/init.d/tinydns {start|stop|stat|restart|hup|help}
[root@cp djbdns]#
AxfrDNS (DNS server on 53 TCP port):
[root@cp djbdns]# /etc/init.d/axfrdns
Usage: /etc/init.d/axfrdns {start|stop|stat|restart|hup|help}
[root@cp djbdns]#
Uninstall
Run djbdns_inst.sh script with "-u" option. See Example 4
Appendix A
Example 1: Getting help
[root@cp ~]# mkdir djbdns
[root@cp ~]# cd djbdns/
[root@cp djbdns]# wget -q http://www.root0.net/djbdns/djbdns_inst.sh
[root@cp djbdns]# chmod 700 djbdns_inst.sh
[root@cp djbdns]# ./djbdns_inst.sh
SYNOPSIS:
djbdns_inst.sh -i -r master -x master_ip [-y slave_ip] [-o os]
djbdns_inst.sh -i -r slave -y slave_ip -x master_ip [-o os]
djbdns_inst.sh -u
OPTIONS:
-i - Install DJBDNS
-u - Uninstall DJBDNS
-r - Role (master or slave)
-x - Master IP
-y - Slave IP
-o - Operation System.
Currently supported OSs are:
(r73, res3, co31, co42, trust)
EXAMPLES:
djbdns_inst.sh -i -r master -x 1.1.1.1
djbdns_inst.sh -i -r master -x 1.1.1.1 -o res3
djbdns_inst.sh -i -r master -x 1.1.1.1 -y 1.1.1.2
djbdns_inst.sh -i -r slave -y 1.1.1.2 -x 1.1.1.1
djbdns_inst.sh -u
SEE ALSO:
http://www.root0.net
[root@cp djbdns]#
Example 2: Installation master DNS on 192.168.103.163 IP
[root@cp djbdns]# ./djbdns_inst.sh -i -r master -x 192.168.103.163 -y 192.168.103.164
OS=co42
Install as master with IP 192.168.103.163
DJBDNS installation
--------------------
- Installation djbdns-1.05.rpm
- Creation users
- Creation directories
- Install new H-Sphere scripts
- Creation configuration file
tcprules tcp.cdb tcp.tmp < tcp
- Creation startup files
- Stop Bind
Stopping named [ OK ]
- Start DJBDNS services
-------------------------
Installation successful
-------------------------
[root@cp djbdns]#
Example 3: Installation slave DNS on 192.168.103.164 IP. (Master 192.168.103.163)
[root@ns2 tinydns]# ./djbdns_inst.sh -i -r slave -y 192.168.103.164 -x 192.168.103.163
OS=co42
Install as slave with IP 192.168.103.164
DJBDNS installation
--------------------
- Installation djbdns-1.05.rpm
- Creation users
- Creation directories
- Install new H-Sphere scripts
- Creation configuration file
tcprules tcp.cdb tcp.tmp < tcp
- Creation startup files
- Stop Bind
Stopping named [ OK ]
- Start DJBDNS services
-------------------------
Installation successful
-------------------------
[root@ns2 tinydns]#
Example 4: Uninstallation DJBDNS
[root@cp djbdns]# ./djbdns_inst.sh -u
OS=co42
DJBDNS uninstallation
----------------------
- Stop DJBDNS services
Stopping tinydns [ OK ]
Stopping axfrdns [ OK ]
- Restore H-Sphere scripts
- Start Bind
- Delete startup files
- Delete djbdns directory
- Delete users
- Uninstall djbdns-1.05
---------------------------
Uninstallation successful
---------------------------
[root@cp djbdns]#
Example 5: DJBDNS test with dig
[root@cp root]# dig root0.net @69.142.122.98
; <<>> DiG 9.3.1 <<>> root0.net @69.142.122.98
; (1 server found)
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58833
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;root0.net. IN A
;; ANSWER SECTION:
root0.net. 86400 IN A 69.142.122.98
;; AUTHORITY SECTION:
root0.net. 259200 IN NS ns.root0.net.
;; ADDITIONAL SECTION:
ns.root0.net. 86400 IN A 69.142.122.98
;; Query time: 2 msec
;; SERVER: 69.142.122.98#53(69.142.122.98)
;; WHEN: Mon Mar 27 14:15:06 2006
;; MSG SIZE rcvd: 76
[root@cp root]#
Home