The dig (Domain Information Groper) command is a popular Linux utility used to perform DNS lookups. It provides more flexibility than Windows NSLookup but, unfortunately, is not available in Windows 10 by default.
One option for using dig on Windows is to install BIND. This tool allows you to use the dig command at the Windows command prompt.
In this tutorial, we will show you how to install BIND and edit Windows environment variables to enable dig. We also provide examples of using the dig command to perform a DNS lookup.
- A system running Windows 10
- An account with administrator privileges
- Access to the command prompt
1. Visit the BIND download page using your preferred web browser.
2. Click the Download button to select the latest stable version of BIND. In this tutorial, we are using version 9.16.23.
3. Click the link to download the BIND installation zip file.
1. Extract the BIND installation file.
2. Open the BINDInstall.exe file as administrator to start the installation wizard.
3. In the Destination Directory field, set the path where you want to install BIND on your system.
4. Set a name for your service account in the Service account name field.
5. Set and confirm a password for the service account.
6. In the Options section, check the Tools only box.
7. Click the Install button to start the installation process.
8. After the installation is complete, click OK to confirm and Exit to close the installer.
Create Windows 1 path variable
. Open the Start menu and search for “environment variables”.
2. Select the Edit system environment variables option.
3. In the System Properties window, on the Advanced tab, click the Environment Variables…. button.
4. Under System Variables, scroll down and select Path, then click the Edit button.
5. In the variable editing window, click New and enter the path to the BIND installation folder (the default path is C:Program FilesISC BIND 9bin).
6. Click OK to confirm the edits to the Path variable.
7. Click OK to confirm the changes and exit the Environment Variables window.
the dig command in Windows
After installing BIND, open the Windows command prompt to start using the dig command. The dig command uses the following syntax:
dig [hostname] [options] Using dig without command options Using the
dig command without any options returns DNS data about the provided host name. For example
: dig google.com The
default output of the dig command contains the following sections
: HEADER: Basic information about the request.
- OPT PSEUDOSECTION: Advanced information about the request
- QUESTION SECTION: The summary of the DNS query. In this example, this is the first available A record for the provided host name.
- RESPONSE SECTION: The response to the DNS query. In this example, this is the IP address of the first A record.
The dig command also allows you to specify the type
of record you want to query using
: dig [hostname] [record type] List all records for a host name
To return all records for the provided host name, use
the Any: dig [hostname] Any option Get the IP address
of a host name
Using the +short option
with the command dig provides abbreviated output (usually just the IP address):
dig [hostname] +short For example: dig google.com +short Check
Add the +trace option
Resolves the query starting from the root name server and moving down, reporting the results of each step
: dig [hostname] +trace
: dig google.com +trace
name server directly The dig command also allows you to query a name server directly: dig @[
address] [hostname] Do a reverse DNS lookup Another use for the dig command is to perform
reverse DNS lookups
: dig -X [IP address]
After reading this tutorial, you should be able to use the dig command at the command
prompt via BIND.
If you want to use dig with a Linux system instead, check out our guide to installing dig on CentOS 7 and 8.