Skip to main content

dig

INTRO

  • dig command stands for Domain Information Groper
  • It is used for retrieving information about DNS name servers.
  • It is used for verifying and troubleshooting DNS problems and to perform DNS lookups.
  • Previous tools used instead of dig
    • nslookup
    • host
  • dig Domain Information Groper, and it collects data about Domain Name Servers.
  • It is helpful for troubleshooting DNS problems,

DIG syntax

dig [server] [name] [type]

  • [server] โ€“ The hostname or IP address.
  • [name] โ€“ The DNS Name.
  • [type] โ€“ The type of DNS record to retrieve.

Options

  • +short --> To check the I.P address from Domain
  • -x --> To work with the I.P address
  • +noall +answer --> To check the answer section

Working with dig command

Below are the some examples how to use dig command.

DNS Lookup

command: dig bajaj-dev.oriserve.com dig_twitter

  • This command causes dig to look up the โ€œAโ€ record for the domain name twitter.com.
    • A record refers to IPV4 IP
    • Similarly, if record type is set as โ€œAAAAโ€, this would return IPV6 IP.

I.P address

  • To display the I.P address, associated with the Domain

commad : dig bajaj-dev.oriserve.com +short I.P_address

Reverse DNS Lookup

  • To display the domain nameby it's IP address.

command : dig -x 172.217.14.238 Reverse_dns

Detailed Answers

  • Sometimes we want to view the answers section in details.
  • For this case, you can stop displaying all the section using +noall option and query the answers section only by using +answer option with the dig command.

command : dig bajaj-dev.oriserve.com +noall +answer Detailed_answers

Multiple DNS

  • We can investigate multiple DNS using a file.
  • Create a file servers.txt and add the required domain names as content. multiple_dns

command : dig -f servers.txt +short final_dns_ouput