Dig

Introduction

dig is a tool to query DNS information. It's very useful to troubleshoot DNS issue or verify correct DNS setup in general. It is provided as part of the BIND DNS server produced by ISC.

Installation on Windows

There is no stand-alone installation package for dig. You have to download the full BIND installation package from the BIND DNS server page. After that you have several options:

  1. Install the full BIND package, this will install dig too
  2. Install the BIND package but select the "Tools Only" option in the BIND Installer configuration screen
  3. Extract the relevant files from the archive without running the package installer

We won't go further into the details on how to install dig. We refer the reader to the following links.

One pitfall to be aware of when doing the installation though is that on 64-bit version of Windows BIND and its tools will be installed in C:\Windows\SysWOW64\dns and not C:\Windows\System32\dns.

Also from what I have seen it looks like you may be able to skip the installation of the VC2005 redistributables on Windows 8 but I didn't look into it further.

A records

dig can be used to get the A records for a domain. The syntax for getting the A records is

dig <domain> A

Since getting the A records is actually the default this is equivalent to

dig <domain>

The example below shows the output of dig when querying the A records for this site.

Using dig to get the A records

C:\windows\system32>c:\Windows\SysWOW64\dns\bin\dig.exe needfulsoftware.com

; <<>> DiG 9.9.4 <<>> needfulsoftware.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29113
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4000
;; QUESTION SECTION:
;needfulsoftware.com.           IN      A

;; ANSWER SECTION:
needfulsoftware.com.    60      IN      A       78.129.172.26

;; Query time: 67 msec
;; SERVER: 192.168.1.254#53(192.168.1.254)
;; WHEN: Mon Sep 21 22:24:41 GMT Daylight Time 2015
;; MSG SIZE  rcvd: 64


C:\windows\system32>

MX records

dig can be used to get the MX records for a domain. The syntax for getting the MX records is

dig <domain> MX

The example below shows the output of dig when querying the MX records for this site.

Using dig to get the MX records

C:\windows\system32>c:\Windows\SysWOW64\dns\bin\dig.exe needfulsoftware.com MX

; <<>> DiG 9.9.4 <<>> needfulsoftware.com MX
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12936
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4000
;; QUESTION SECTION:
;needfulsoftware.com.           IN      MX

;; ANSWER SECTION:
needfulsoftware.com.    600     IN      MX      10 in1-smtp.messagingengine.com.

needfulsoftware.com.    600     IN      MX      20 in2-smtp.messagingengine.com.


;; Query time: 52 msec
;; SERVER: 192.168.1.254#53(192.168.1.254)
;; WHEN: Mon Sep 21 22:32:55 GMT Daylight Time 2015
;; MSG SIZE  rcvd: 114


C:\windows\system32>

Choosing the nameserver

The @ option allows to specify the nameserver the query should be sent to as in the example below.

Using dig to get the MX records

C:\windows\system32>c:\Windows\SysWOW64\dns\bin\dig.exe needfulsoftware.com @8.8.8.8

; <<>> DiG 9.9.4 <<>> needfulsoftware.com @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45990
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;needfulsoftware.com.           IN      A

;; ANSWER SECTION:
needfulsoftware.com.    59      IN      A       78.129.172.26

;; Query time: 1159 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Mon Sep 21 22:36:52 GMT Daylight Time 2015
;; MSG SIZE  rcvd: 64


C:\windows\system32>

blog comments powered by Disqus

Copyright(c) 2006-2017 Xavier Leclercq | Privacy policy

Home
Contact Us
Search