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!
$ 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.
nslookup -query=ns <server.com>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With