Join the Webinar | Strong Protection Against Cyber Threats

Dig Command and Usage

dig command It is a command line tool often used to query DNS nameservers. IP address records are used to troubleshoot many DNS issues, including responses from authoritative nameservers. The dig command stands for Domain Information Groper.

“dig” is included as standard in most existing Linux distributions.

To find out if the Linux system used is available dig -v It can be checked by running the command. If the current Linux system is not available, it can be installed with the help of the following commands.

To install Ubuntu and Debian sudo apt update && sudo apt install dnsutils

To install on CentOS and Fedora sudo yum install bind-utils

To install Arch Linux sudo pacman -S bind-tools commands will suffice.

Structure of the dig command

dig performs DNS querying in the following regular structure.

dig [server] [name] [type]

[server] – server or IP address to query

[name] – DNS of the server to be queried, that is, the domain name

[type] – the type of DNS record you want to find out. If this row is left blank, the A record will be queried as standard.

Some Examples for the dig command

As a standard, when a domain name is specified next to the dig command, it displays a lot of information such as A record, dig version, technical explanations about answers, statistics about the query made.

When you want to learn only the IP address (A Record) with the dig command +short used with the parameter.

To view the ANSWER SECTION output in the standard dig command directly +noall +answer parameter is used directly.

To enable querying using the domain name server with dig, prefix the domain's address. @ The query is made by putting the letter.

To query DNS record types ANY The query is made by specifying the parameter.

MX to query your record MX The query is performed by specifying the parameter.

SOA to query your record SOA The query is performed by specifying the parameter.

in the specified domain TTL to find value information. TTL parameter is added.

CNAME to query your record CNAME The query is performed by specifying the parameter.

NS to query your record NS The query is performed by specifying the parameter.

To the specified NS record @ By adding the parameter, more detailed information about the name server is obtained.

To monitor in detail about the query phase of the specified domain from Root DNS +trace parameter is added.

Reverse DNS, that is, to search for domains associated with the IP address, -x This is done by specifying the parameter.

Domain names in a .txt file can be queried simultaneously with dig. For this -f The domain name file created with the parameter can be specified and querying can be done.

Similarly, it is possible to query the domain names by ordering them side by side so as not to disturb the command structure of dig.

Explanation of Dig Commands

-I – Performs Reverse DNS query using IPv6

-f – Specifies the filename

-p – used to specify a port number

-t – used to specify the query type

-k – Used to specify a TSIG key file

-4 – Specified only when querying IPv4

-6 – Specified only when querying IPv6

Query Options of Dig Command

+recurse – Search is performed in Recurse DNS mode

+cmd – used to control the CLI

+stats – Used to display statistics

+nssearch – Specified when displaying authoritative nameservers

+dnssec – Used to view DNSSEC records

 

Categories Articles