views:

38

answers:

2

Hi,

I am looking for a way to get the primary and secondary NS records of a given domain name, and the IP addresses associated with it. Which means that I am looking for these: dns1: ip1: dns2: ip2:

Now this kind of information is available from websites like intodns.com, but I am working on a huge list of domains and would like to automate this process with a bash script (probably not the best choice for this...).

I tried "nslookup domain.com", which gives me ip1. "hostname domain.com" returns nothing... I also tested "dig domain.com TYPE NS" which doesn't add much info.

At this point I am thinking of a wget of the intodns.com page and parsing the html to get what I need... Do you know of any better way for doing this?

Thanks a lot!

+2  A: 

$ dig example.com NS

works just fine for me. No, it doesn't resolve the IP addresses of the nameservers, but that's not part of the NS record. You'll have to do that yourself. Unlike the output of whois, it's in a standardized format, so it'll be easier to parse.

Chris
Hey Chris, yes it works... I feel very bad now that I didn't figure out how to use dig by myself :s Thank you!
Samantha
A: 
nslookup -query=ns <server.com>
ghostdog74