Step 3: Change the Zone Datafile Naming Convention

This step is optional. Chances are, your BIND zone datafiles don’t follow the same naming convention used by the Microsoft DNS Server. Recall from Chapter 4 that the Microsoft convention is the name of the zone followed by the .dns extension—for example, movie.edu.dns. You can continue to use your current naming convention, but if you add new zones with the DNS console, they’ll have the .dns extensions unless you go out of your way to make the names conform to your scheme. If you’re not particularly attached to your naming scheme and don’t want to fight the DNS console every time you create a new zone, this Perl script will rename your zone datafiles in the .dns style and modify your named.boot file accordingly:

# name-convert.pl--Convert zone datafile naming convention in a BIND # named.boot file to Microsoft *.dns format # die "usage: name-convert.pl path-to-named.boot\n" unless $ARGV[0]; open (BOOTIN, $ARGV[0]) || die "Can't open boot file for reading: $!\n"; open (BOOTOUT, ">boot") || die "Can't open boot file for writing: $!\n"; while (<BOOTIN>) { $dir="$1/" if /^directory\s+(.+).*$/; &changeit (1, $1, $2) if /^primary\s+(.+)\s+(.+)$/; &changeit (2, $1, $5, $2) if /^secondary\s+([\w\.]+)\s+(((\d{1,3}\.){3}\ d{1,3}\s+)+)(.+)$/; &changeit (3, "cache", $1) if /^cache\s+\.\s+(.+)$/; } sub changeit { local ($zonetype, $zonename, $oldfilename, $mastersips) = @_; $newfilename="$zonename.dns"; rename ($dir.$oldfilename, $dir.$newfilename) ...

Get DNS on Windows Server 2003, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.