Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Compare DNS Zone Transfers

Posted on 2006-11-20
5
Medium Priority
?
358 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

Looking for the Wi-Fi vendor that's right for you?

We know how difficult it can be to evaluate Wi-Fi vendors, so we created this helpful Wi-Fi Buyer's Guide to help you find the Wi-Fi vendor that's right for your business! Download the guide and get started on our checklist today!

Question has a verified solution.

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

If you’re involved with your company’s wide area network (WAN), you’ve probably heard about SD-WANs. They’re the “boy wonder” of networking, ostensibly allowing companies to replace expensive MPLS lines with low-cost Internet access. But, are they …
Make the most of your online learning experience.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

604 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