0

If I have a nameserver with name ns1.mydomain.com, and I want to query the IP for this name, but don't want to query the authoritative name servers for mydomain.com. Can this be done with dig, or similar command line tool?

4 Answers 4

2

If you want to know the name servers for a domain exmaple.com usually you need to first request the NS records dig ns example.com then you can request the IP addresses for those NS records.

If you are asking how to determine what the name servers are for a domain you need to follow the standard resolution mechanism. So for the host ns1.example.com you would start asking by asking the root servers for the NS records for .com, then you would ask the .com servers for the NS records for example.com.

3
  • right, and then say that the NS record for example.com tells you the first nameserver is ns1.example.com. What next? How do you lookup the IP for that hostname, so you can resolve, say www.example.com? This is what leads to believe there is a special query "get the IP of a nameserver" which doesn't follow exactly the same route. Am I getting it wrong? May 13, 2010 at 20:33
  • dig ns example.com doesn't tell me anything useful. Try for instance dig ns ns1.google.com. May 13, 2010 at 20:54
  • also see my own answer to this question. That did it for me. May 13, 2010 at 21:04
1

i don't know if i understand, but it seems you want dig ns1.mydomain.com unless you want to query a specific server for the IP address of ns1.mydomain.com, in which case: dig @nsserverofchoice ns1.mydomain.com

0

To find name servers for domain in question:

host -t ns mydomain.com

To simply find IP of (for instance) dns2.mydomain.com:

host dns2.mydomain.com
0

To make this more practical, let's take google.com as an example:

  1. dig ns google.com tells you that the name servers for google.com are ns1.google.com to ns4.google.com.
  2. Google registered with their registrar (MarkMonitor) what the IP of ns1.google.com is. To look it up, run dig ns a.gtld-servers.net to find the name servers for .com. Among the list, there is a.gtld-servers.net.
  3. Finally, run dig @a.gtld-servers.net ns1.google.com. This will give you the IP addresses that Google registered with their registrar for their name servers (not the IP they defined in their own DNS, which, granted, should be the same).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .