Quick and Dirty DNS Testing

Quick and easy sanity checks…

My requirement was to test 500 A/PTR records.  The client didn’t feel comfortable with bulk loading the records, so the work had been split up to be manually added between multiple resources – I was concerned, and didn’t have much time to find the errors.

Process followed:

  1. Save a file containing all your IP’s
  2. Save a file containing all FQDNs
  3. Run the following from windows cmd:

FOR /F %i in (txt) DO nslookup %i >> resolutions-ip.txt 2>> failures-ip.txt

FOR /F %i in (.txt) DO nslookup %i >> resolutions-fqdn.txt 2>> failures-fqdn.txt

  1. Go have coffee and think how clever you are
  2. Realize that this could actually be scripted properly in Python and realize how clever you aren’t

This quickly gave me a great list of missed records from STDERR.  The duplicates and mismatched records were confirmed with some regex magic in notepad++ on the STDOUT output.

3mins work for pretty good yield, but if it’s a repetitive task (it wasn’t for me… yet…), script it properly!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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