How to Install dig on Windows 10/11
Domain Information Groper, commonly known as dig command, is a DNS lookup utility that is very popular on Linux. Dig is a more flexible and better DNS tool than the Windows Nslookup tool.
Unfortunately, it isn’t shipped with Windows 10, but we can get a version of dig that runs on Windows 10/11 by installing BIND tools.
The quickest way to install DIG on Windows 11/10 is to use the Chocolatey package manager. Open a PowerShell console and execute the following command to install Chocolatey:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
After that, run the following command to install the bind-toolsonly
package:
choco install -y bind-toolsonly
And that is it! You can now run the dig command from both CMD and PowerShell.
If for some reason, you don't like to use the Chocolatey, you can still install DIG by manually downloading the bind tool package. The following section provides detailed instructions on how to do it.
Download BIND for Windows 10
Open a web browser, navigate to www.isc.org/download/ and download the latest version of BIND.
For Windows 10, we need to download the 64bit zip file.
Install Bind Tools
After the download has finished, extract the ZIP file. Then right-click on the BINDInsall and choose run as administrator from the contextual menu.
Check the Tools only checkbox and click the Install button.
If successful, you will see the message: "BIND installation completed successfully".
Add Dig to Windows Path variable
There is one more thing. We need to add the bin directory (C:\Program Files\ISC BIND 9\bin
), which contains the dig.exe
file, to the Windows PATH variable.
Right-click on This PC and select Properties. Go to Advanced system settings > Environment Variables. Edit the PATH variable under the System variables.
Click the New button and paste the path C:\Program Files\ISC BIND 9\bin
.
And that is all we need to do.
Using the dig command
The basic usage of the dig command is to specify the domain name you want to look up and the type of record you want to query (e.g. A for address records, MX for MX records). Let's see a couple of examples.
Find IP address of a website or domain (A record):
dig example.com A
Find IPv6 address of a domain (AAAA record):
dig example.com AAAA
We can specify the nameserver we'd like to query:
dig A example.com @8.8.8.8
Looks up MX records:
dig mx example.com
The -x
option performs a reverse lookup when you specify the IP address:
dig -x 8.8.8.8
Types of DNS records you can query include: A, AAAA, MX for Mail exchanger, NS, and TXT.