dig vs nslookup

72,299

Solution 1

dig uses the OS resolver libraries. nslookup uses is own internal ones.

That is why Internet Systems Consortium (ISC) has been trying to get people to stop using nslookup for some time now. It causes confusion.

Solution 2

For a while nslookup was being reported as a deprecated application and should not be used anymore.

The output even warned you of this:

Note: nslookup is deprecated and may be removed from future releases. Consider using the 'dig' or 'host' programs instead. Run nslookup with the '-sil[ent]' option to prevent this message from appearing.

excerpt from http://cr.yp.to/djbdns/nslookup.html

Do not use the ancient nslookup program. Whatever you're trying to do, there's a better way to do it. Even the BIND company, which maintains and distributes nslookup, says ``nslookup is deprecated and may be removed from future releases.''

However in the release notes from Bind 9.9.0a3 there is an entry (#1700) which states the following:

1700.   [func]      nslookup is no longer to be treated as deprecated.
                    Remove "deprecated" warning message.  Add man page.

The Wikipedia page also states this:

As of BIND 9.9.0a3, nslookup has apparently been resurrected ("nslookup is no longer to be treated as deprecated"). (The Internet Systems Consortium had previously deprecated nslookup in favor of host and dig for some time.)

So it would seem that nslookup is perfectly fine to use along with dig. In addition to the 2 tools using different resolvers, there are things that are easier to do in dig vs. nslookup, though nslookup is generally the easier of the 2 tools to use day to day.

Also dig's output is typically easier to parse in scripts or in command line usage.

Share:
72,299

Related videos on Youtube

pylover
Author by

pylover

Updated on September 18, 2022

Comments

  • pylover
    pylover over 1 year

    Why do the commands dig and nslookup sometimes print different results?

    ~$ dig facebook.com
    
    ; <<>> DiG 9.9.2-P1 <<>> facebook.com
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6625
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
    
    ;; OPT PSEUDOSECTION:
    ; EDNS: version: 0, flags:; udp: 512
    ;; QUESTION SECTION:
    ;facebook.com.            IN    A
    
    ;; ANSWER SECTION:
    facebook.com.        205    IN    A    173.252.110.27
    
    ;; Query time: 291 msec
    ;; SERVER: 8.8.8.8#53(8.8.8.8)
    ;; WHEN: Sun Oct  6 17:55:52 2013
    ;; MSG SIZE  rcvd: 57
    
    ~$ nslookup facebook.com
    Server:        8.8.8.8
    Address:    8.8.8.8#53
    
    Non-authoritative answer:
    Name:    facebook.com
    Address: 10.10.34.34
    
  • ata
    ata about 10 years
    Actually the decision to obsolete nslookup has been reverted, at least in the nslookup provided by ISC. Source: kb.isc.org/article/AA-00496/0/BIND-9.9.0a3-Release-Notes.htm (Entry # 1700)
  • QMaster
    QMaster about 5 years
    @ata Link you provided doesn't exist anymore.
  • Jeff
    Jeff about 5 years
    Had a weird situation today where nslookup would not return any result (would time out) but using systemd-resolve worked very well. This was a new one for me and I will likely use systemd-resolve in the future instead of nslookup.