Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have over 250 domain names with one registrar which, due to years of organisational neglect, point to various different servers hosting the websites.

I've been asked to clean this up. sigh

To start off, I want to get a list of each domain name and their DNS A records to see which server they're pointing to. Does anybody know how I can go about this?

share|improve this question

closed as not a real question by mulaz, EEAA, John Gardeniers, Ward, HopelessN00b Sep 25 '12 at 23:54

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Put all the domains in a txt file, loop over them in your favorite scripting language... Done... (If you want more info, we need some more info. OS, Language... – Bart De Vos Sep 24 '12 at 15:49
We might be able to give you some shortcuts if you name the registrar. But any way you go, this is going to be one big unsightly mess. – Michael Hampton Sep 24 '12 at 21:14
up vote 1 down vote accepted

Here's how I'd do it in PowerShell using a text file with one domain per line.

Get-Content domains.txt | %{
  new-object -type PSObject -property @{

Which outputs something like:

Domain                IPAddr
------                ------        {2001:4860:4001:803::1011,, 74.125.224....         {2001:4998:c:401::c:9101, 2001:4998:c:401::c:9102, 200...        {,,, 98.1...   {} {}

Here's how I'd do it in Perl with the same text file.

perl -MSocket -nE 'chomp; say $_, " ", inet_ntoa "".gethostbyname $_;' domains.txt

Which outputs something like:
share|improve this answer
I used the PowerShell solution above and it produced the effect I wanted. Thanks, Starfish. However, the script hangs after about a dozen domains, do you know of any reason why this would be? Edit: Scrap that, if I hit return, the script continues. – bobble14988 Sep 25 '12 at 9:01

An even easier answer is to get the DNS records from the registrar to see where they're pointing. Most good bulk registrars have an export function just for this kind of thing. Now, if they're all being hosted off site, you might need to resort to the code to get A records for them. But seeing that DNS resolution has been delegated to will be a big clue to help you locate the appropriate hosting company and start working on obtaining credentials.

share|improve this answer

In Bash:

Put your domains, one per line, in domains.txt.

for domain in $( cat domains.txt ); do host -ta $domain; done

That'll print something like: has address has address
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.