C.3 Step 3: Change the Zone Data File Naming Convention


DNS on Windows 2000, 2nd Edition
By Matt Larson, Cricket Liu
Table of Contents
Appendix C.  Converting from BIND to the Microsoft DNS Server

This step is optional. Chances are, your BIND zone data files 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 extensionfor 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 data files in the . dns style and modify your named.boot file accordingly :

 # name-convert.plConvert zone data file 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="/" if /^directory\s+(.+).*$/;     &changeit (1, ,) if /^primary\s+(.+)\s+(.+)$/;     &changeit (2, , ,) if /^secondary\s+([\w\.]+)\s+(((\d{1,3}\.){3}\     d{1,3}\s+)+)(.+)$/;     &changeit (3, "cache",) if /^cache\s+\.\s+(.+)$/; } sub changeit {     local ($zonetype, $zonename, $oldfilename, $mastersips) = @_;     $newfilename="$zonename.dns";     rename ($dir.$oldfilename, $dir.$newfilename)  print "Error renaming      $oldfilename to $newfilename!\n";     if ($zonetype == 1) { print BOOTOUT "primary $zonename $newfilename\n";     } elsif ($zonetype == 2) { print BOOTOUT "secondary $zonename $mastersips $newfilename\n";     } else { print BOOTOUT "cache . $newfilename\n";     } } 

The script takes one argument, the name of the name server boot file. For example:

 name-convert.pl /etc/named.boot 

It outputs a file called boot in the current directory, which is a Microsoft DNS Server boot file with the zone data filenames changed. It's probably easiest to run the script on the BIND name server (which is probably running Unix and therefore has Perl installed), then copy over boot and the newly renamed *.dns zone data files.


DNS on Windows 2000
DNS on Windows 2000
ISBN: 0596002300
EAN: 2147483647
Year: 2001
Pages: 154

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net