Testing tool for DNS migrations

Testing tool for DNS migrations

Very useful tool to test your DNS zone files using python. I have tested this script to validate changes done on a production zone file. The initial request was the following :

  • cleanup an existing Bind DNS zone file
  • remove unnecessary $TTL
  • sort DNS entry by type to make easy searching and editing

When the new version of the zone file has been completed, a comparison has been done between this file and the production zone file hosted on a bind server (for the example the ip address is :
python /home/user/dns_compare.py -z yourzone.domain --file /home/user/yourzone.domain.dns-newfile  --server

The output will show you all the differences and you will be able to check if there are errors in your new zone file before you use it in production :

By default, SOA and NS records are ignored because these records are likely to change when migrating a zone between DNS services.. Specify –soa or –ns option, respectively, to enable checking of SOA and NS records.

Comparing TTLs can be disabled with -t option. This is useful when transferring DNS to a provider that offers only specific TTL values.

dnspython is required to run this tool. Just run the following command to install it :
apt-get install python-dnspython



My Powershell script categories



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Social Media Auto Publish Powered By : XYZScripts.com
%d bloggers like this: