Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The former master dns server crashed. I'm trying to use dig to get zone data from the slaves servers, which I don't control (peer1.net), and I get transfer failed messages

root@dnsserver:# dig +tcp -t ixfr=0 @ns1.peer1.net domain.com

; <<>> DiG 9.8.1-P1 <<>> +tcp -t ixfr=0 @ns1.peer1.net domain.com
; (1 server found)
;; global options: +cmd
domain.com.     38400   IN  SOA dns1.dnsserver.com. my.mail.com. 2012010301 10800 3600 604800 38400
; Transfer failed.

Slaves aren't capable to transfers zones?

Is there a way to build bind's zone files?

about the backup the backup disk somehow trashed and is unreadable, according to the data center team. It was a secondary disk which on weekends was mounted and rsynced with primary, apparently it got corrupted months ago, I didn't noticed it. I had a remote backup of /root /etc /var/lib/mysql & /home so when I heard that the backup disk was unreadable I didn't blink, but after seeing that my remote backup didn't include bind -> /var/named/chroot/etc/bind I started to feel a cold shiver on my back.

update 2 In desperate times comes desperate measures, I managed to write a script that helps me somewhat.

#!/bin/bash
# 2013/01/21
# Building hosts files for bind9 from a list of domains in a txt file

DNS=some.dnsserver.net

for d in `cat domains`; do
    echo "\$ttl 38400" > $d.hosts
    dig +nocmd @$DNS $d any +multiline +noall +answer >> $d.hosts
    for cname in 'www' 'ftp' 'mail' 'webmail'; do
        dig +nocmd @$DNS $cname.$d CNAME +multiline +noall +answer >> $d.hosts
    done
    # now include input in /etc/bind/named.conf.local
    echo -e "zone \"$d\" {" >> /etc/bind/named.conf.local
    echo -e "\ttype master;" >> /etc/bind/named.conf.local
    echo -e "\tfile \"/var/lib/bind/$d.hosts\";" >> /etc/bind/named.conf.local
    echo -e "\t};" >> /etc/bind/named.conf.local
done

With this script I was able, at least, to have the basic zone info... I couldn't find a way to query for subdomains. Google is my friend, but I couldn't find it. gist https://gist.github.com/4589883

share|improve this question

3 Answers 3

Restore from Backup

Slaves are transfer capable by RFC, but it's generally administratively disabled.

share|improve this answer

Slaves are perfectly capable of acting as the source for zone transfers. Yours are probably just not configured to allow it, or at least not to allow it from the IP address you're querying from.

It's common for authoritative nameservers to be configured to only allow zone transfers from a whitelist of IP addresses of slave servers that are expected to be used. Since it's unusual for any slaves to be slaving off other slaves, servers that are themselves slaves usually permit no zone transfers as a result.

If you did obtain the contents of the zone from the slave server, you could install the file as is on the rebuilt master server (ugly though it may look).

share|improve this answer
    
I get some contents, but no enough to set the complete zone. I thought slaves could, by default, transfer a zone back to it's master. –  Juparave Jan 21 '13 at 3:10
    
You are correct: by default, they can: see isc.org/software/bind/documentation/arm95 under "allow-transfer" which says "If not specified, the default is to allow transfers to all hosts.". It's just that it's unusual for DNS server operators to leave the default configuration in place. –  Celada Jan 21 '13 at 16:32

Of course you realize, that the slave in a bind implementation generates a copy (without your comments) of the zone files. You could simply copy these zone copy files into the master and use them while you are retrieving the original zone files on the masters from backups.

share|improve this answer
    
It is correct, but I don't have access to those files. –  Juparave Jan 21 '13 at 6:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.