Home > Microsoft, Network > Getting DIG to work on Windows

Getting DIG to work on Windows

As a network engineer, there are a number of tools that are absolutely critical to my job, that I use on a daily basis.  One of those tools named “dig”, is included as part of the BIND package from the Internet Systems Consortium (ISC).  For those not familiar with “dig”, it is a command line query tool used to troubleshoot DNS issues.

Due to my need to support a number of specialty applications, I run a Windows PC as my main work laptop.  This is unfortunate as Microsoft’s command line diagnostic tools (such as nslookup) are quite weak.  While I could SSH into a Linux/Solaris/whatever host each time I need to troubleshoot something, I often find myself on foreign networks with only my trusty laptop available.  A number of years ago I figured out how to get dig running on my Windows machines and have never looked back.

To run dig on a Windows box you could install the full windows version of BIND (which includes dig), but that is quite overkill if all you want is dig.  Instead, I recommend downloading the latest stable precompiled windows binaries of BIND, extracting the .zip, and then copying the files listed below into your c:\windows directory (really you could put them anywhere in your PATH but c:\windows is easy and I doubt the filenames will ever conflict).

  • dig.exe
  • libisc.dll
  • libdns.dll
  • libeay32.dll
  • libbind9.dll
  • libisccfg.dll
  • liblwres.dll

Voila!  You can now run dig from the command prompt!

C:\Users\eric.rosenberry>dig bitplumber.net

; <<>> DiG 9.6.0-P1 <<>> bitplumber.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1886
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;bitplumber.net.                        IN      A

bitplumber.net.         14400   IN      A

;; Query time: 210 msec
;; WHEN: Sun Mar 15 00:05:54 2009
;; MSG SIZE  rcvd: 48


Categories: Microsoft, Network Tags:
  1. December 10th, 2009 at 05:50 | #1

    Good how-to. Thanks

  2. jamkomo
    February 20th, 2010 at 15:46 | #2

    Did you put your company’s nameservers in \windows\system32\drivers\etc?

  3. February 20th, 2010 at 15:51 | #3

    I did that a long time ago the first time I installed DIG on Windows, but since then it seems to have “just worked”. I think it reads the system DNS servers as the default if that file does not exist.


  4. MrT
    September 1st, 2010 at 21:55 | #4

    I’m not able to get dig to work. Several articles all name the same dlls/exes to put in the desired directory, which I’ve done and confirmed. But when I run it, I get

    “The system cannot execute the specified program.”

    This error is reported to be caused by missing DLL dependencies, but I can’t find any info on dependencies for DIG. I tried registering a couple of the DLLs but that errors out (but I thought the first run of dig.exe would cause them to self-register anyway).

    It’s also not a path problem. And as of v9, resolv.conf isn’t required.

    Any ideas? Anyone? (I can’t find a suitable forum at ISC for this, either.)

  5. Pete
    November 18th, 2010 at 12:36 | #5

    You probably didn’t install the C++ redistributable package(vcredist_x86.exe). Use the one that comes in the BIND zip archive. I tried the latest one for Visual C++ 2008 and it didn’t work.

  1. No trackbacks yet.