Dig is a really useful networking tool. I use it several times a day. But always on Linux where it’s usually built-in. On Raspberry Pi’s raspbian you can install it with a simple apt-get install dnsutils. Then I learned it wasn’t hard at all to install on Windows, especially as a fairly minimalist installation that just puts files on your PC and makes no changes to the Registry, which is all you really need for light use.
Go to http://www.isc.org/downloads/. Expand BIND.
Click download button for the current stable release.
Pick the win-64-bit link (because chances are you’re running Windows 64 bit these days) and wait for download to complete.
Open up zip file.
Unzip or extract all files to (this is my suggestion) c:\apps\bind.
To run it
Open a command window. Probably easiest way is hold down Windows key + r and type in cmd. In CMD window simply type \apps\bind\dig to run dig like you do on Linux.
Example 1, Resolve address for google.com
C:\> \apps\bind\dns google.com
; <<>> DiG 9.9.8-P2 <<>> google.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24929 ;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;google.com. IN A ;; ANSWER SECTION: google.com. 88 IN A 188.8.131.52 google.com. 88 IN A 184.108.40.206 google.com. 88 IN A 220.127.116.11 google.com. 88 IN A 18.104.22.168 google.com. 88 IN A 22.214.171.124 google.com. 88 IN A 126.96.36.199 ;; Query time: 41 msec ;; SERVER: 192.168.2.1#53(192.168.2.1) ;; WHEN: Mon Jan 11 12:16:17 Eastern Standard Time 2016 ;; MSG SIZE rcvd: 135
This gives all kinds of useful information – what your default DNS server is (at the bottom – mine is 192.168.2.1), how long the query took *this one: 41 msec), whether the answer is authoritative or not (no AA flag here, so this is not an authoritative answer), as well as the answer to the question posed.
Example 2, Resolve nameserver records for the domain amazon.com using Google’s DNS server 188.8.131.52 over TCP from our local IP address of 192.168.2.3
We started out slow, but this example throws the kitchen sink at you to show the power of dig!
C:\> \apps\bind\dig +tcp -b 192.168.2.3 ns amazon.com @184.108.40.206
; <<>> DiG 9.9.8-P2 <<>> +tcp -b 192.168.2.3 ns amazon.com @220.127.116.11 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64444 ;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 512 ;; QUESTION SECTION: ;amazon.com. IN NS ;; ANSWER SECTION: amazon.com. 3599 IN NS ns3.p31.dynect.net. amazon.com. 3599 IN NS ns4.p31.dynect.net. amazon.com. 3599 IN NS ns1.p31.dynect.net. amazon.com. 3599 IN NS pdns1.ultradns.net. amazon.com. 3599 IN NS pdns6.ultradns.co.uk. amazon.com. 3599 IN NS ns2.p31.dynect.net. ;; Query time: 50 msec ;; SERVER: 18.104.22.168#53(22.214.171.124) ;; WHEN: Mon Jan 11 12:27:26 Eastern Standard Time 2016 ;; MSG SIZE rcvd: 188
The only problem is that I don’t think the TCP option actually worked – I gotta run wireshark to verify. On Linux it definitely works! Not sure what’s wrong with windows. But the other options are working as designed.
OK, wireshark install is failing, but I ran tcpdump on a DNS server I run and confirmed that indeed the +tcp option is working forcing dig to use TCP communication for those queries.
I believe you do
$ sudo apt-get install bind9-dnsutils
At least on a generic Debian system that works. I have to confirm on RPi still.
We’ve demonstrated a low-impact way to install dig for Windows and shown some examples of using it.
References and related
Current BIND link from ISC: https://downloads.isc.org/isc/bind9/9.16.8/BIND9.16.8.x64.zip