Query DNS for multiple domains at once

I have recently moved servers and want to query all of the accounts domains on the new server to check that they are all resolving to the correct NS.

I am currently using http://www.whatsmydns.net/#NS which is great.

However, it's rather a slow process for 100 domains!

Can anyone recommend any tool available?

Thanks


Solution 1:

Use dig from the command line, or nslookup if you're on windows. Either of these would be trivial to script and get the data you need.

Solution 2:

Are they external domains or internal domains? In any case, you can run something like:

I will use serverfault.com as my example domain here.

To resolve the hostname: www.serverfault.com

dig @4.2.2.2 www.serverfault.com +short

To find out the NS for your domain, serverfault.com

dig serverfault.com ns

To find the authoratative name servers for your domain:

dig serverfault.com +nssearch

If you have 100 external domains, you can write a for look and run as a shell scripts. Make sure all zones you are trying to query are on a separate lines. If you know your DNS or want to include in the dig command you can do so as: dig @4.2.2.2 $zone +short

In the above command 4.2.2.2 was my DNS Server.

#!/bin/bash
while read zone; do dig $zone +short; done <myzones.txt