I just went through something similar - updating a bunch of zone files, to get them all in a sane state and structured the same.
As they're all hosted on the same network, they all had similar records.
I did it with sed, and make.
Basic theory - write a template file like:
ZONEFILE-TEMPLATE
Code:
$TTL 2d ; Zone default TTL 2 days
$ORIGIN #DOMAIN#. ; BCM zonefile template v0.16
@ IN SOA ns1 hostmaster.yourdomain.com. (
#SOA# ; serial number
30m ; Refresh
3m ; Update retry
7d ; Expiry
3h ) ; Minimum
IN NS #DNS1#
IN NS #DNS2#
IN MX 10 your-common-mx-here.
IN A #ARECORD# ; DEFAULT BCM website IP
ns1 IN A #NS1#
.... etc....
(essentially, anything with #foo# will be replaced by definitions in the next file...)
Then, I made a file for substitutions for each domain, like:
IN.byrnecut.com.au
Code:
s/#SOA#/2011110301/g
s/#DOMAIN#/byrnecut.com.au/g
s/#WWW#/61.8.187.150/g
s/#ARECORD#/61.8.187.150/g
s/#DNS1#/ns1/g
s/#DNS2#/ns1.telstra.net./g
... etc ...
And then run this through sed, like:
Code:
cat ZONEFILE-TEMPLATE | sed -f INPUT/IN.byrnecut.com.au > byrnecut.com.au
As I have heaps of domains, I automated that with a Makefile, eg:
Makefile
Code:
byrnecut.com.au: INPUT/IN.byrnecut.com.au ZONEFILE-TEMPLATE
cat ZONEFILE-TEMPLATE | sed -f INPUT/IN.byrnecut.com.au > byrnecut.com.au
(copy/paste/modify above 2 lines for additional domains)
You will need to tweak to suit your environment, and be careful to run it all in a test directory first (and back up your zone files!!).... but that works for me.
Its a fair bit of work up front, but it means that for me adding new zones is very easy (create substitution file, add 2 lines to my Makefile, add zone to
named.conf), and updating them all in one hit means changing the details in the template and running make (plus bumping the SOA, I should move that to the template file

).
It makes it a lot harder to screw up with typos... (conversely, a typo in my template screws all my domains simultaneously

)