On linux, when I hit man nslookup a lot of things say: not implemented. I'm wondering how to use nslookup program to fetch the following informations:

  • 1) my local DNS server
  • 2) DNS servers for some site(e.g. google.com, facebook.com)
  • 3) How to query for Type A, NS, CNAME, MX RRs?
  • Do you have to use nslookup? Could you use dog instead? – davidgo Apr 1 '18 at 4:58
  • If you can show me all the answers for above, then why not? – bzal Apr 1 '18 at 5:12

I don't think that NSLOOKUP or Dig can provide your local DNS servers, as this is an OS call. This is (usually) most easily done by

cat /etc/resolv.conf

on unix systems, however it looks like doing an nslookup will tell you the nameserver used for the query, so

 nslookup google.com 

will return a "Server:" line which has the server IP which was queried.

To query DNS servers for a site using your local nameservers -

dig sitename.com ns

You can do the same thing using other nameservers (as long as those nameservers will allow you to do the lookup) by using @domain name - for example dig @ facebook.com NS will tell you Facebooks nameservers according to the nearest Google Nameserver. You could also do dig com NS to find a list on nameservers for .com domain names, then query one of those nameservers to see what the authorative nameservers think.

To query a record type

dig sitename.com RECORDtype

For example dig sitename.com MX will show you the MX records for the site, or dig sitename.com A will provide the A record(s).

| improve this answer | |
  • This is a perfect answer for the question. But as a side request since I can't post this on this site, do you recommend any resources to practically approach computer networking which supplements ONLY theory side that computer degree pursuing students face? – bzal Apr 1 '18 at 10:31

Got to love auto-correct. The utility that davidgo was referring to is called dig. For example, looking up SIP SRV records in Linux would be done using: dig SRV _sip._tcp.domain.com

| improve this answer | |
  • What is SIP/SRV Records? – bzal Apr 1 '18 at 5:13
  • If possible could you please answer the three bullets in my question above? – bzal Apr 1 '18 at 5:15
  • I work in the telecommunications industry, so that is my most frequently used record type. However, for what you want to achieve you can replace SRV with the record type that you desire e.g. dig domain.com MX. More examples can be found here: linux.com/learn/check-your-dns-records-dig – Stuart Minchington Apr 1 '18 at 5:15
  • What about my local DNS server and other sites' DNS servers? – bzal Apr 1 '18 at 5:17
  • I need some clarification on points 1 & 2. Are you trying to figure out what your local DNS server is or are you trying to force a lookup to utilize your local DNS server? Are you trying to identify the name servers that somebody else is using? – Stuart Minchington Apr 1 '18 at 5:26

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.