GO KALI FREE

dig

Information Gathering

Beginnerlow risk

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).

Installation

sudo apt install dnsutils

Basic Syntax

dig <domain> [type]

Quick Facts

Full Name
dig (Domain Information Groper)
License
ISC License
Author
ISC (Internet Systems Consortium)
Written In
C
Platforms
Linux, macOS, Windows
Category
DNS Lookup
Part of
BIND DNS toolkit

Tool Overview

Dig (Domain Information Groper) is the industry-standard DNS lookup tool from ISC. It queries DNS servers for any record type and provides detailed, structured responses that are essential for DNS troubleshooting and security assessment.

Unlike simpler tools like nslookup, dig provides complete DNS response data including headers, question sections, answer sections, and authority sections. This level of detail makes it indispensable for DNS professionals and security researchers.

Dig supports zone transfer testing, reverse DNS lookups, batch queries, and scriptable output formats. It is the tool of choice for DNS security assessments and troubleshooting complex DNS configurations.

Common Commands

dig example.com ANYAll records lookup - Query target servers for all available DNS records simultaneously
dig example.com axfrZone transfer query - Request a complete zone transfer duplicate file from target nameservers
dig example.comBasic A record lookup
dig example.com MXMail server records
dig example.com NSName server records
dig example.com AXFR @ns1.example.comZone transfer
dig -x 192.168.1.1Reverse DNS lookup
dig +short example.comShort output
dig example.com TXTTXT records
dig example.com AQuery IPv4 address records
dig example.com AAAAQuery IPv6 address records
dig example.com MXQuery mail exchange records
dig example.com NSQuery name server records
dig example.com TXTQuery text records including SPF
dig example.com SOAQuery start of authority record

Step-by-Step Guide

  1. 1Execute a standard lookup to find the primary IPv4 address mappings
  2. 2Query for MX records to locate email handling servers
  3. 3Identify the authoritative infrastructure by looking up NS records
  4. 4Attempt an AXFR query to check if zone transfers are misconfigured
  5. 5Inspect TXT records for potential security misconfigurations or verification tokens

Warnings

Use Cases

DNS Record Lookup

Query any DNS record type (A, AAAA, MX, NS, TXT, SOA, SRV).

Zone Transfer Testing

Test if DNS servers allow unauthorized zone transfers.

Reverse DNS Lookup

Resolve IP addresses to hostnames using PTR records.

DNS Troubleshooting

Diagnose DNS resolution issues with detailed query output.

DNS Security Assessment

Audit DNS configurations for security misconfigurations.

Key Features

Related Tools

nslookup

Information Gathering

Simple DNS lookup tool for quick queries.

DNSenum

Information Gathering

DNS enumeration tool for subdomain discovery.

Frequently Asked Questions

What is dig used for?

Dig (Domain Information Groper) is a DNS lookup tool used for querying DNS servers, testing zone transfers, performing reverse lookups, and troubleshooting DNS issues. It provides detailed responses for any DNS record type.

Is dig better than nslookup?

Dig provides more detailed output and supports all DNS record types. Nslookup is simpler for basic queries. Dig is preferred by DNS professionals; nslookup is more beginner-friendly.

What DNS record types can dig query?

Dig supports all DNS record types including A, AAAA, MX, NS, TXT, SOA, SRV, CNAME, DNSKEY, DS, and more.

Can dig test zone transfers?

Yes, dig can test for zone transfers with: dig @server domain AXFR. If successful, the entire DNS zone is transferred.

How do I use dig for reverse lookups?

Reverse lookups resolve IP addresses to hostnames: dig -x 8.8.8.8. This queries the PTR record for the IP.

How do I install dig?

Install dig using: sudo apt install dnsutils on Kali Linux. On other systems, install the bind9 or bind-utils package.

How do I query a specific DNS server with dig?

Use @ before the server: dig @8.8.8.8 example.com to query Google's DNS server directly.

What is the +short flag in dig?

The +short flag outputs only the answer without extra details: dig +short example.com returns just the IP address.

What is the +trace flag in dig?

The +trace flag shows the full DNS resolution path from root servers, useful for understanding DNS hierarchy.

How do I query MX records with dig?

Use dig example.com MX to see mail server records. Add +short for just the mail server hostnames.

How do I query TXT records with dig?

Use dig example.com TXT to see text records, often used for SPF, DKIM, and domain verification.

What is the AXFR query in dig?

AXFR requests a full zone transfer from a DNS server. If allowed, it returns all DNS records in the zone.

How do I use dig for DNS troubleshooting?

Use dig +trace example.com to see the full resolution path. Compare results from multiple DNS servers to identify inconsistencies.

Can dig check DNSSEC?

Yes, use dig +dnssec example.com to query DNSSEC records like DNSKEY and DS for DNS security validation.

What is the ANSWER SECTION in dig output?

The ANSWER SECTION contains the resolved DNS records. It shows the record type, TTL, and value for each query.

How do I batch queries with dig?

Use dig -f queries.txt to run multiple queries from a file, one per line.

How does dig compare to host command?

dig provides more detailed output and scripting support. host is simpler for quick lookups with human-readable output.

Tags

#dns#reconnaissance#network#lookup

Output Explanation

Dig output shows DNS query results organized by record type. The ANSWER SECTION contains resolved records (A, AAAA, MX, NS, TXT, CNAME, SOA). Status code indicates success (NOERROR) or failure (NXDOMAIN). TTL values show caching duration. The AUTHORITY SECTION lists nameservers.

Ethical Usage Notice

This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.