Skip to content

Install Dig & WSL

☣┌͜∩͜┐͜(͜◣͜_͜◢͜)͜┌͜∩͜┐☣ edited this page Feb 20, 2024 · 4 revisions

BIND9 dig(domain information groper) is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried. It is useful for network troubleshooting and for educational purposes. Other lookup tools tend to have less functionality.

Installation (Windows)

Warning

BIND9 version 9.16.x and its tools(dig tool) is the last* branch of development with native support for Windows

  • Download zip, open and run BINDInstall.exe file.

  • Install BIND in the following directory: C:\Program Files\ISC BIND 9. Select the Tools Only check box.

  • Once BIND is installed, open Control Panel, and then open System.

  • Open advanced system settings from right tab, click Environment Variables.

  • Under System Variables, select Path, and then click Edit.

  • At the end of the path in the Edit System Variable window, add C:\Program Files\ISC BIND 9\bin, and then click OK.

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

  • Open new terminal window and run dig -v to check version and confirm its installed.

Use WSL2 to get the latest* versions of dig for Windows

Windows Subsystem for Linux (WSL) is a feature of Windows that allows you to run a Linux environment on your Windows machine, without the need for a separate virtual machine or dual booting. WSL is designed to provide a seamless and productive experience for developers who want to use both Windows and Linux at the same time.

Caution

WSL 2 is available in Windows 11
or
Windows 10 versions :
x64 systems: Version 1903 or later, with Build 18362.1049 or later.
ARM64 systems: Version 2004 or later, with Build 19041 or later.

Use WSL 1 for older builds.

Download the latest kernel package for WSL2:

x64 based PC
arm64 based PC

Tip

If you're not sure what kind of machine you have, open Command Prompt or PowerShell and enter:

systeminfo | find "System Type"
  • Open PowerShell as administrator and enable Virtual Machine Platform & Windows Subsystem for Linux:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  • Restart your machine to complete the installation and then select WSL version 2 using PowerShell as administrator:
wsl --set-default-version 2

Install a Linux distribution from Microsoft Store app or if store is not available, you can download files manually from https://learn.microsoft.com/en-us/windows/wsl/install-manual#downloading-distributions or use command line to install Linux distributions .

  • Method 1 - Command line (easiest)

To get a list of all available distros:

wsl -l -o

Install Distro:

wsl --install -d YourDistroName
  • Method 2 - Download file (more distro options)

Once the distribution has been downloaded, navigate to the folder containing the file and run the following command from Powershell in that directory (right click, select "open Powershell here"), where app-name is the name of the Linux distribution .appx or .appxBundle file.

Add-AppxPackage .\app_name.appx

Once the process of installing your Linux distribution with WSL is complete (it will be installed to Windows Apps), search and open distro using the start menu search.

You will be asked to create a username and password for your Linux distribution. Once finish it can be started in PowerShell using wsl command and check dig version using dig -v.
If dig not installed, get it from dnsutils package. Run:

sudo apt install dnsutils

Optional

building BIND9 with dig tool

For Android install termux from its repo(PlayStore version is outdated)

Upgrade packages:

pkg upgrade

Install dig:

pkg install dnsutils

Basic commands

To query domain “A” record

dig google.com

Query specific name server

dig google.com @8.8.8.8

Specify port number

dig @8.8.8.8 -p 53 google.com

Using IPv4 & IPv6
By default dig queries are running over the IPv4 network, we can specify to use the IPv4 with the “-4” option, or alternatively to use the IPv6 with the “-6” option.

dig -4 @8.8.8.8 google.com  
dig -6 @2001:4860:4860::8888 google.com

Localhost

dig @127.0.0.1 google.com  
dig @fe80::1 google.com