Question

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 them.

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 the primary NS IP address.

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!

Was it helpful?

Solution

$ 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.

OTHER TIPS

nslookup -query=ns <server.com>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top