[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Auto-secondarying DNS daemon



martin f krafft wrote:
also sprach Paul TBBle Hampson <Paul.Hampson@Pobox.com> [2006.10.03.1521 +0200]:
Is there such a piece of software around as an auto-secondarying DNS
daemon?

PowerDNS can do this. The concept is called
supermasters/superslaves.

It cannot remove zones yet. #376036.


If the issue is that you don't want to edit the bind zone file on the secondary our script below may work for you. Essentially:


	2) $EDITOR /etc/bind/named.conf.local # on central machine
	3) run script (below):
		rsync /etc/bind to other dns servers
		rndc reload other dns servers

At least in our low volume environment, The bind replication mechanism is kludgier than rsync.

The master/slave server thing is a bit arbitrary. All our DNS servers think they are the "Primary" and as far as the outside world is concerned, they are. Unlike MX records NS records have no concept of priority. The primary/seconday master/slave thing is entirely internal to the bind DNS server implementation

Our solution has the additional advantage of not requiring us to muck around with serial numbers in SOA records or worry about secondary servers expiring zones if the primary is down for extended periods of time. (which it isn't)


#!/bin/sh

# $Revision: 1.1 $
# $Source: /usr/local/cvsroot/boxes/scripts/some/dnssync,v $
# %Location: /usr/local/sbin/
# %Servers: brave csl-dns-01

# get password for remote rsync
. /etc/local/dns.sync.authorize

#defaults
OPTIONS='-azl '
EXCLUDE='--exclude=old/ --exclude=named.options --exclude=rndc.* '

echo reloading localhost
rndc -s localhost reload


for HOST in csl-dns-01.thecsl.org csl-dns-02.thecsl.org csl-dns-03.thecsl.org ; do

        echo  -ne "\n$HOST "
        echo -ne "\t copy files... "
        rsync $OPTIONS $EXCLUDE /etc/bind/  ${HOST}::dns_records

        echo -ne "\t reload server... "
        rndc -s $HOST reload 2>/dev/null \
                || echo -n "FAILED"

        echo -ne "\t test dns is up... "
        dig  @$HOST thecsl.org 2>&1 > /dev/null \
                || echo -n "FAILED"

done
echo



Reply to: