On complex environments, it is sometimes quite a chore to keep primary and secondary DNS servers in sync. These scripts are designed to export a list of DNS zones from a Blueonyx primary server, with the intent that they will be able to be imported as secondary DNS zones on another server.
There are two settings that you should change in these scripts
Once you get these scripts, put them in say an hourly cron job, and its all done.
#!/bin/bash cd /etc/named/named CCE=/usr/sausalito/bin/cceclient DOMAINS=/var/www/html/dnsdomains.txt SUBNETS=/var/www/html/dnssubnets.txt ls db*.com db*.org db*.net | sed -e "s/^db.//" > $DOMAINS if [ -e $SUBNETS ]; then rm $SUBNETS fi for X in `echo find DnsSOA domainname = \"\" | $CCE| grep ^104 | cut -d " " -f 3` do MASK=`echo get $X | $CCE | grep netmask | grep ^102 | cut -d "\"" -f 2` IP=`echo get $X | $CCE | grep ipaddr | grep ^102 | cut -d "\"" -f 2` echo $IP:$MASK >> $SUBNETS done exit 0
#!/bin/bash DOMAINS=/tmp/dnsdomains.txt SUBNETS=/tmp/dnssubnets.txt CCE=/usr/sausalito/bin/cceclient MASTERIP=1.2.3.4 wget -q -O- http://$MASTERIP/dnsdomains.txt > $DOMAINS wget -q -O- http://$MASTERIP/dnssubnets.txt > $SUBNETS COUNT=`cat $DOMAINS | wc -l` if [ $COUNT -lt 1 ]; then echo Did not find domain list - Bailing fi /root/dnsDeleteAllRecords.pl --delete-confirm for X in `cat $DOMAINS` do echo CREATE DnsSlaveZone masters = \"$MASTERIP\" domain = \"$X\" | $CCE done for X in `cat $SUBNETS` do IP=`echo $X | cut -d ":" -f 1` NETMASK=`echo $X | cut -d ":" -f 2` echo CREATE DnsSlaveZone masters = \"$MASTERIP\" netmask = \"$NETMASK\" ipaddr = \"$IP\" | $CCE done