Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I currently have a DNS server which is serving as a master DNS server for a number of our domains. I want to set up a brand new secondary DNS server. Is there any way I can automatically have BIND on the new server act as a secondary for all the domains on the primary server?

In case it matters, I have Webmin on the primary server. I believe Webmin has an option to create a zone as a secondary on another server when creating a new master zone on one server, but I don;t know of any way to batch create secondary zones for a number of existing master zones. Maybe I'm missing something.

Is there a way to "batch create" DNS slave zones on a brand new slave DNS server for all the DNS zones on an existing master?

share|improve this question
up vote 7 down vote accepted

Writing a script to do this shouldn't take very long, especially if you name the zone files after the domain.

ls master.dir > domain.list

foreach domain (`cat domain.list`)
echo 'zone "$domain" { type slave; file "slave/$domain"; masters { }; };' >> named.conf.slaves

And add include named.conf.slaves; to your named.conf

share|improve this answer
+1 for smart way. And of course "rndc reconfig" after this. – plluksie Jan 11 '11 at 20:20
+1 And just make sure that the relevant allow-transfer (;} is either the options stanza so that the server can transfer all zones. Alternatively, make sure that allow-transfer(;} is in each zone that the slave will be pulling. This presumes the slave is at – Niall Donegan Jan 11 '11 at 21:14

In Webmin, when you configure a new slave, you will be given the option to copy over all zones on the master to the new slave. The Virtualmin docs have a section about slave DNS servers, and if you're only using Webmin, you'd just skip the end bits about making Virtualmin use the slave server. The steps for Webmin are the same.

Specifically, the option you want is "Create all existing master zones on slave?" which will copy over all the data.

Webmin can also turn the slave into a master in the future, if needed.

share|improve this answer

Scripting will probably be required. Get a list of all domains you are master for, and use that list to setup the slave configs.

You will also probably need to setup the masters to allow transfers from the slave server. Another option is TSIG ( )

share|improve this answer

The easiest way would to be to copy the configuration from the master.

A short perl script should be able to replace the master keyword with slave and add the pointer to the master.

As Christopher noted, you will also need to modify the configuration of the master to allow zone transfers from the master.

I also noticed a security notice for bind which indicates that you should ensure all your zones have an allow-query clause.

share|improve this answer

Your Answer


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.