How to set up DA as slave DNS server?

Eggies

New member
Joined
Oct 25, 2004
Messages
1
Hi,

currently we have 1 master and 1 slave DNS servers running. We set up a new DA server for the hosting purposes but ended up decided it to be a third DNS server (slave box in this case).

As i am totally new to DA, please kindly advise what should be the steps.

Currently the Master DNS server is hosting 200 plus domains and autosynch to the slave DNS server (both running BIND 9.2.2) and we intended to migrate 100 plus domains to DA, with the rest still on our other webservers.

What should i do to make DA server a slave server without adding the domains in for hosting purposes? Please advise.

cheers
 
I've written a few files that "automatically" transfer all DNS records to another server.

I'll explain my situation a bit:
I have 1 master DNS server using ns1.domain.com and ns2.domain.com (which is a mistake).
The secundairy DNS server uses ns3.domain.com and ns4.domain.com.
New users will have to use ns1 and ns3 if they want to be safe.

I use this file on the master server to make a list of domains for the second server:
Code:
#/bin/bash
IP=`cat /usr/local/directadmin/scripts/setup.txt | grep "ip=" | cut -d= -f2`;
#echo "Local IP address is" $IP;

rm -f /var/www/html/<secret>/horus.named.conf

cd /var/named
#local i
for i in *; do
        DOMAIN=`echo $i | gawk -F".db" '{ print $1 }'`;
        echo "zone \"$DOMAIN\" in { type slave; file \"/var/named/backup/$i\"; masters { $IP; }; };" >> /var/www/html/<secret>/horus.named.conf

done

chmod 666 /var/www/html/<secret>/horus.named.conf

After which this file is ran on the second server:
cd /var/named && rm -f horus.named.conf && wget -q ip_masterserver/<secretdir>/horus.named.conf && service named restart

Note that in the /etc/named.conf on the second server, I have this:
Code:
// Server backup nameserver config includes
include "/var/named/horus.named.conf";

Also; make sure the /var/named/backup dir exists.
Both commands for both servers run in a cron (1x day), as the servers will automatically sync existing domains :).

This method will also work for more servers.

Hope you, and others, can use it.
Took me 2 days to get working (mostly reading docs about Bind).

edit: forgat one command
edit2: Note that with the include in the /etc/named.conf DA will work just fine. Also domains from other servers will not interfere with domains on this server, due to the simple fact they're in another dir (although I don't know how Bind would react).
 
Last edited:
Your system is very similar to the one we're building.

Our system is a bit more sophisticated, though.

Here are some problems with your system you might want to consider:

1) setup.txt is not the best place to get the system IP from; you'd be better off getting it from the output of ifconfig. setup.txt will never change, even if your system IP changes. If you believe yor system IP will never change then instead of getting it from setup.txt just hard code it into your file.

2) Your webserver is searchable by Google and other spiders unless you put in a robots.txt file. Even so it's not really "secret".

3) If your master server goes down the slave will delete the include file yet not be able to get the new one, so it will stop serving DNS just when you really need it.

3) If you've DNS hosted for the same domain on two servers the duplicate entries will cause named to fail to restart and the slave DNS server will be nonfunctional.

Jeff
 
jlasman said:
Your system is very similar to the one we're building.

Our system is a bit more sophisticated, though.

Here are some problems with your system you might want to consider:

1) setup.txt is not the best place to get the system IP from; you'd be better off getting it from the output of ifconfig. setup.txt will never change, even if your system IP changes. If you believe yor system IP will never change then instead of getting it from setup.txt just hard code it into your file.
In our case this is not really a problem, the IP's are rather static, but for other users, it might indeed be a problem.

2) Your webserver is searchable by Google and other spiders unless you put in a robots.txt file. Even so it's not really "secret".
Added to todo list ;-)

3) If your master server goes down the slave will delete the include file yet not be able to get the new one, so it will stop serving DNS just when you really need it.
Ok, that's a nice one, let's think about this one for a while. Need to build in some form of (error)checking

4) If you've DNS hosted for the same domain on two servers the duplicate entries will cause named to fail to restart and the slave DNS server will be nonfunctional.
How are you solving this one ?


Please note: While setting up our new sec. DNS server, I lost all stuff for the second server; I know we had a better way to arrange this, but I lost the file.
So for this thread (and our current implimentation) I reconstructed it from what I could remember :D
Second note: Backup stuff from test server before a reformat to change it to a production server...
 
jlasman said:
We're not. Yet. Which is why I'm not distributing my system yet :( .

Jeff
The only one I couldn't get solved yet.
(I'll write a RedHat howto when i have some time)

The secundairy server now uses an bash script (with logging) instead of one line of commands...
And I switched to Curl for downloads, due to the fact wget's timeout settings gave errors.

So instead of
After which this file is ran on the second server:
cd /var/named && rm -f horus.named.conf && wget -q ip_masterserver/<secretdir>/horus.named.conf && service named restart
I now have this file: http://hathor.sebsoft.nl/DAStuff/fetchdns.horus.sh

So the command becomes:
/<location to script>/fetchdns.<servername>.sh.

After a wget, don't forget to chown +x it :) (and READ the file settings before use, Sebsoft isn't responsable for problems caused by the scripts...)
 
ok, since today we're useing my new system. What was true, is that named.ca/named.local/localhost.zone want to come too. So I changed a few lines to re'parse' the output of the first bash file.
This way, those zones are dropped. All I now need to figure out is a way to make sure subdomains aren't counted.
(example:
domain.com is on server 1, but php5.domain.com is on server 2)

My change was adding/chaning the following (or something like it) :
Code:
for i in *; do
        DOMAIN=`echo $i | gawk -F".db" '{ print $1 }'`;
        echo "zone \"$DOMAIN\" in { type slave; file \"/var/named/backup/$i\"; masters { $IP; }; };" >> /var/www/html/<something>/tmp

done

cat /var/www/html/<something>/tmp | grep -v named.ca | grep -v named.local | grep -v localhost.zone > /var/www/html/<something>/<name>.named.conf
rm -f /var/www/html/<something>/tmp
 
Back
Top