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

I have a webapp that acts as a DNS manager, writing all zones to "/var/named". I would like to be able to configure named to load all zones in that folder, without explicitely having to tell it which zone goes to which file.

Is that remotely possible?

The reason for this is that i will be having a lot of zones added/deleted and a lot of records for each of them. I was thinking for using a database for that, but the idea of doing 500 record inserts scares me (it needs to be snappy). It's easier to write to a file.

Any suggestions?

share|improve this question

3 Answers 3

up vote 1 down vote accepted

As the problem is stated, this is not possible with bind9. However, the problem really is to do with how you can make significant changes to which zones you are serving for, without a performance hit.

Possible suggestions are:

  • dynamically loadable zones with bind9

  • bind10 (but this is not mature, you probably don't want to rely on it for critical production environments)

  • another dns server, such as powerdns. If you're using the default recommended schema for a SQL backend to powerdns, it will serve all of the zones in the domains table, so if you can have your "dns manager" update that table then you're in business. At the very least, an immediatge, kludgy workaround would be to have powerdns's zone2sql tool take the zone files that your dns manager app creates and insert them into the db.

share|improve this answer
    
I heard good things about powerdns, but i can't seem to find anywhere how can i include an entire directory of zones. Can you point me in the right direction? –  alexcepoi Feb 7 '11 at 16:42

As others have said, this is not directly possible.

But, you can still automate it!

Setup a script (makefile, bash, what-have-you) that generates a proper bind9 config file containing all the zone blocks:

AUTOZONEFILE=/var/lib/named/etc/named.conf.autozone

cp -a $AUTOZONEFILE $AUTOZONEFILE.old
> $AUTOZONEFILE.new
for zonefile in /var/lib/named/master/autozones/*; do
    CURZONE="$(basename "$zonefile")"
    cat <<EOF >> $AUTOZONEFILE.new
zone "$CURZONE" {
    type master;
    file "master/autozones/$CURZONE";
};
EOF
    done

cat $AUTOZONEFILE.new > $AUTOZONEFILE
rm $AUTOZONEFILE.new
rndc reload

Try something like that out.

share|improve this answer
    
something like this was the backup solution.. just thought i could take the easy way out... :) –  alexcepoi Feb 8 '11 at 2:17

I don't believe it's possible. BIND likes to have each zone separately configured with its own zone block containing the name of the zone file and the domain name therein.

share|improve this answer

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.