DNS

 

Example usage

$ dig @ns74.domaincontrol.com simontech.me -t AXFR

Common dig Commands

Below are some common dig commands to retrieve DNS information about a hostname. You can run any of the examples in a terminal to see the output.

CommandExampleDescription
dig <hostname> dig example.com Returns the A records found at a hostname.
dig <hostname> any dig example.com any Returns all records for a hostname, including NS and SOA records.
dig @<name server address> <hostname> <record type> dig @ns1.digitalocean.com example.com MX Queries a hostname's name server directly instead of your ISP's resolver. Include the record type parameter to retrieve records of a specific type at a hostname. DigitalOcean's name server addresses are: ns1.digitalocean.com, ns2.digitalocean.com, and ns3.digitalocean.com
dig <hostname> <record type> dig example.com NS Only returns the records of a specified type at a hostname.
dig <hostname> +short dig example.com +short Only returns the IP addresses for all A records at a hostname.
dig <hostname> +trace dig example.com +trace Adding +trace instructs dig to resolve the query from the root name server and return information from each server queried in the delegation chain.

dig commands return one or multiple sections of information about the hostname's DNS records depending on the syntax of your query. 

; 
$ dig example.com
<<>> DiG 9.10.6 <<>> example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50169
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 5

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

;; ANSWER SECTION:
example.com.		6108	IN	A	93.184.216.34

;; AUTHORITY SECTION:
example.com.		52437	IN	NS	b.iana-servers.net.
example.com.		52437	IN	NS	a.iana-servers.net.

;; ADDITIONAL SECTION:
a.iana-servers.net.	195	IN	A	199.43.135.53
a.iana-servers.net.	195	IN	AAAA	2001:500:8f::53
b.iana-servers.net.	195	IN	A	199.43.133.53
b.iana-servers.net.	195	IN	AAAA	2001:500:8d::53

 

 

To install dig for Windows, go to BIND’s website and download the most current version of BIND 9. Extract the downloaded file and double click the BINDinstall icon in the newly created directory.

dns subdomain bind install.3a5b27dd8561a3ea3b47d07af4705a0f64a14ce978b01c0dee7dea6feab5fb24

On the BIND 9 Installer screen, verify that the target directory is set to C:\Program Files\ISC BIND 9 (or C:\Program Files (x86)\ISC BIND 9 if you are using an x86 architecture) and select the Tools Only check box. Then click Install.

dns subdomain bind installer.12c0dfdbac063b858883197067eb00e19c6607e217ac2c04b6abbc7c3d2c7edf

Once you've installed BIND 9, you need to add BIND to your system's paths to make dig available from the command line. To add the path to your system, open the Windows Control Panel and then open your System Properties. In the Advanced tab, click Environment Variables.

dns subdomain bind environment variables.c12fc45d9815438de723246107973c7522179f56c52fc52b075e25aa7f35ae3d

Under System Variables, select the Path variable and then click Edit.

dns subdomain edit path.9f4e63042f90d28fe612059235408961e0c45f54f33addda45881858061db562

In the Edit environment variable screen, click New and enter the new path C:\Program Files\ISC BIND 9\bin (or C:\Program Files (x86)\ISC BIND 9 if you are using an x86 architecture). Once you've added the path, click OK.

dns subdomain new path.25c33966070883e07b80759af6708b774b3ce87199987c26f28d07891838efe3

In the Edit Variables window, click OK. In the System properties window, click OK.

Once you've added the path variable, open a new Command Prompt window and verify dig's installation by running the dig -v command. dig should return version information about itself. If the command returns anything other than version information, verify your path variable configuration.

Book Your Free Consultation

Submit your name and email below to schedule your free 15 minute initial consultation to see how we can help your business succeed