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'm currently using Cpanel to manage my BIND server and it's painful to update 100+ records whenever server the records pointing to is down.

Is there a faster way to update BIND records? The cpanel way requires multiple clicks. The command line way is also slow very you have VI into every zone, edit, and save.

It will be nice if I can have a pre-recorded zone ready. When I need to switch, all I need to do is to replace the zone files.

share|improve this question
Have you considered using CNAMEs, instead of maintaining 100+ identical records ? –  b0fh Feb 10 '12 at 12:46

4 Answers 4

If this is something you are doing often for some reason, then you could simply create to sets of configuration files and database files, then simply make your named.conf be a symlink to whatever version of the file you want active. When you need to switch, change the symlink and restart.

// named.primary.conf for primary link
zone "example.org" {
        type master;
        file "/etc/bind/master/example.org.primary.dns";

// named.backup.conf for primary link
zone "example.org" {
        type master;
        file "/etc/bind/master/example.org.backup.dns";
share|improve this answer

Working from the command line can be very fast if you use the right tools. For example, you can use a command like the following to find specific files and do the needed replacement.

$ find /path -name "*.zone" | sudo xargs sed -i 's/string/replacement/g'

You need to change the search criteria according to your needs and files naming. Also, I think it will be a good idea to run sed without -i option at the beginning to make sure you are doing it right, or at least take a backup of your files.

share|improve this answer

A variation of Khaled's sed command:

perl -pi.bak -e 's/string/replacement/' *zone

This will cause perl to create a .bak file for each file it runs against. You can, of course, come up with more complicated perl in the expression, if that's necessary.

It also wouldn't hurt to go to your directory of zone files and set up version control there. Something like:

git init
git add /path/to/zone/files
git commit -m 'Initial checkin'

will set up the repo. Then you can use git commands to manage your versioning.

share|improve this answer

Do you have multiple domains, all of which have essentially the same zone file?

If so, then I found that the easiest way is to simply remove all but one copy of all these zone files, and symlink all the names of the removed zone files to the single one left. In the said single zone file, make sure to avoid all absolute references to any of your such domains, e.g. use "@ IN AAAA ..." instead of "example.com. IN AAAA ..." etc. Viola, you can now edit a single zone file, and have the changes be applied to all the domains at once.

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.