cancel
Showing results for 
Search instead for 
Did you mean: 

dig and nslookup

Jean Samarani
Frequent Advisor

dig and nslookup

Hi Community,

would anyone advise why we are able to get a result when we send a DNS query using nslookup while when using dig the answer section is empty ??

; <<>> DiG named 9.2.0 <<>>
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35907
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0


Br/ Jean
5 REPLIES
Matti_Kurkela
Honored Contributor

Re: dig and nslookup

HP-UX nslookup can use /etc/hosts in addition to DNS. The dig command uses DNS only.

MK
MK
Jean Samarani
Frequent Advisor

Re: dig and nslookup

ok but the domain that I am querying exist in my DNS files only.
rick jones
Honored Contributor

Re: dig and nslookup

IIRC dig will query for exactly what you give it, and only for that, whereas nslookup may go through the "try appending different suffixes based on either domain or search directives in /etc/resolv.conf" bit.

You might also try capturing the packets sent to port 53 when each command is run to see what other differences there might be in what sorts of queries dig forms vs nslookup.
there is no rest for the wicked yet the virtuous have no pillows
Norm Diederich
Honored Contributor

Re: dig and nslookup

Jean,

Try using did with the fully qualified domain name.

Also dig -X IP Address.

Regards,
Norm
Bill Hassell
Honored Contributor

Re: dig and nslookup

nsquery is a better choice to follow the resolver steps. The resolver follows the instructions in /etc/nsswitch.conf and actually documents what it is doing at each step.

nsquery hosts 1.2.3.4
nsquery www.hp.com
nsquery mycomputer


Bill Hassell, sysadmin