?
Solved

Compare DNS Zone Transfers

Posted on 2006-11-20
5
Medium Priority
?
351 Views
Last Modified: 2007-02-12
Hello-

I am looking for a way to compare AXFRs from two servers.  We have upgraded our VitalQIP Enterprise server and want to make sure no DNS entries were dropped from the central database during the upgrade process.  We want to pull the DNS Zone from the production server and compare entry for entry with that in a test environment.  

Thank you!
0
Comment
Question by:aaeandcee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 28

Expert Comment

by:mikebernhardt
ID: 17981261
Just put both db files on the same machine with ftp or something, and use diff to compare. If you're on Windows, there's freeware called CSDiff that does the same thing (compares 2 files and shows you what's different. Or write a little perl script that will parse the file, pull only lines that start with an IP address, sort them and count them. If the count is different, it should be easy to find the missing entries if they're sorted.
0
 

Author Comment

by:aaeandcee
ID: 17981358
I'm dealing with zones that are several thousand entries in all.  We have tried WinDiff in the past, but with WinDiff we have missed entries.  We are looking for something that would definitively compare zone files, not just line placement, count, etc.
0
 
LVL 28

Expert Comment

by:mikebernhardt
ID: 17981718
I don't think you'll find a tool that's made to do the somewhat uncommon job you have in mind, and why pay more? I would definitely write a perl script to do it then. I mean, it's a text file. Let it parse for only the actual host entries, then sort and count them (that way you don't get caught because of an extra line with a semicolon in it or something). If the count is the same, you're good. If not, THEN use diff and you'll find the exact spot where the mismatch occurs.
0
 

Author Comment

by:aaeandcee
ID: 17981829
That doesn't sound like too bad of an idea.  I'm not that proficient with Perl, any examples on how to write the script?
0
 
LVL 28

Accepted Solution

by:
mikebernhardt earned 750 total points
ID: 17982626
Here you go. This script finds sorts lines that begin with numbers 1-9, dumps them into 2 new files and tells you how many lines are in the new files. If they don't match, then use diff on the new files and you'll find the problems quickly. Fix them in the original files and run the script again. You may have to do a few iterations of this if there are numberous problems.

#!/bin/perl
# read the zone files
open (ZONE1, "./zone1.db");
open (ZONE2, "./zone2.db");
@zone1 = <ZONE1>;
@zone2 = <ZONE2>;
# set counter
$x = 0;
$y = 0;
# open new writeable files
open (SORTED1, ">./sortedzone1.db");
open (SORTED2, ">./sortedzone2.db");
# sort the data
@zone1 = sort  {$a <=> $b} @zone1;
@zone2 = sort  {$a <=> $b} @zone2;
#parse out junk and create new file for checking
foreach (@zone1) {
#      chomp;
      if ($_ =~ /^[1-9]/) {
        $x++;
        print SORTED1;
        }
}
foreach (@zone2) {
#      chomp;
      if ($_ =~ /^[1-9]/) {
        $y++;
        print SORTED2;
        }
}
print "\@zone1 has $x lines\n\@zone2 has $y lines\n";
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most of the applications these days are on Cloud. Cloud is ubiquitous with many service providers in the market. Since it has many benefits such as cost reduction, software updates, remote access, disaster recovery and much more.
This article is in regards to the Cisco QSFP-4SFP10G-CU1M cables, which are designed to uplink/downlink 40GB ports to 10GB SFP ports. I recently experienced this and found very little configuration documentation on how these are supposed to be confi…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question