Solved

Compare DNS Zone Transfers

Posted on 2006-11-20
5
339 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 250 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Question about Buffalo NAS devices 4 52
Cisco router external connection issues. 6 34
Distinguished username as email address 4 45
Router speed limit 7 62
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
If you're not part of the solution, you're part of the problem.   Tips on how to secure IoT devices, even the dumbest ones, so they can't be used as part of a DDoS botnet.  Use PRTG Network Monitor as one of the building blocks, to detect unusual…
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

749 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