So as the title says I want to get the IP of the DNS server that respond when I'm trying to reach a specific domain, using bash commands.

If I understood it right, when I'm trying to reach www.somedomain.com, the query is first sent to my "local" DNS who is then gonna ask some external DNS servers if it can't find it in its tables.

I feel like the output I get when I'm typing

nslookup somedomain.com


dig somedomain.com

at the Server line is the IP of my local DNS, since its the same for every website I try. How do I get the IP of the "real" DNS that responded?

Sorry If I understood everything wrong, and thanks in advance.


The authoritative name server should be in the domain's NS record.

In Windows, this can be looked up

nslookup -type=ns somedomain.com

In Linux, something like

dig somedomain.com NS +noall +answer

should work.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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