Skip to content

Install Dig & WSL

☣┌͜∩͜┐͜(͜◣͜_͜◢͜)͜┌͜∩͜┐☣ edited this page Feb 19, 2024 · 5 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

BIND9 version 9.16.x and its tools is the last branch of development with native support for Windows

  • Extract the downloaded file and 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.

Option 2

Use Windows Subsystem for Linux(WSL) to get the latest versions of dig from dnsutils package or build BIND9

Note

Using WSL 2 which is only available in Windows 11 or Windows 10(Version 1903, Build 18362 or later). Use WSL 1 for older builds.

  • Download the latest package:

x64 based PC - https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
arm64 based PC - https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_arm64.msi

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

To get a list of all available distros:

wsl -l -o

Install Distro:

wsl --install -d YourDistroName
  • Download file method

Once the distribution has been downloaded, navigate to the folder containing the download and run the following command in that directory (right click in folder, 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), open the distribution 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, run:

sudo apt install dnsutils

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
Clone this wiki locally