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.

Quick Reference Commands

Verified quick-reference commands for dig
CommandPurpose
dig <name> AQuery IPv4 address records.
dig <name> MXQuery mail-exchanger records.
dig @<server> <name> NSAsk a specific DNS server for nameserver records.
dig -x <address>Perform a reverse-address lookup.
Linux command reference
bind9 | Kali Linux Tools

Common Commands

dig example.com ANYIssue a QTYPE=ANY query; the server may return some or all available RRsets
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 SOAQuery start of authority record
dig example.com CNAMEQuery canonical name records
dig @8.8.8.8 example.comQuery using Google DNS server
dig example.com +traceTrace full DNS resolution from root
dig example.com +shortShow only the answer IP
dig -x 1.2.3.4Reverse DNS lookup
dig example.com +noall +answerShow only answer section
dig example.com AXFRRequest full DNS zone transfer
dig example.com +dnssecRequest DNSSEC secured records
dig example.com NSECQuery next secure domain record
dig example.com DSQuery delegation signer record
dig example.com +statsShow query statistics
dig -f queries.txtBatch resolve from file
dig example.com +time=5 +tries=3Set timeout and retries
dig example.com SRVQuery service location records
dig example.com CAAQuery certificate authority records
dig example.com +subnet=1.2.3.0/24EDNS client subnet query

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

DNSenum

Information Gathering

DNSenum is a multithreaded Perl script for DNS enumeration that discovers DNS records, attempts zone transfers, brute-forces subdomains, and performs reverse lookups. It is a foundational reconnaissance tool in Kali Linux for mapping a target domain's DNS infrastructure.

Subfinder

Information Gathering

Learn how to use Subfinder in this beginner tutorial, from installing ProjectDiscovery's passive subdomain tool to running and reading your first authorised scan. Add API keys for wider coverage, save clean results, and chain Subfinder into httpx to validate live web hosts before further testing.

Amass

Information Gathering

OWASP Amass is the industry-standard in-depth network mapping and attack surface discovery tool. It uses active and passive techniques, scraping 20+ public data feeds, DNS enumeration, and certificate transparency logs to discover subdomains, IP addresses, and ASN data — making it essential for penetration testing, bug bounty hunting, and enterprise security assessments.

Fierce

Information Gathering

Fierce is a PERL script that quickly inspects a target domain for non-contiguous IP space and hosts by combining brute force testing, reverse lookup mapping, and wildcard tracking.

DNSRecon

Information Gathering

DNSRecon provides the ability to check NS records, MX records, zone transfers, SRV records, and cache snooping capabilities within a comprehensive Python network inspection script environment.

Masscan

Information Gathering

Masscan is an internet-scale port scanner. It can scan the entire Internet in under 6 minutes, transmitting up to 10 million packets per second utilizing asynchronous transmit setups.

Related Cybersecurity Guides

OSINT · Intermediate

How to Do DNS Enumeration: Beginner's Guide to DNS Recon in Kali Linux

Learn how to do DNS enumeration step by step with dig, nslookup, dnsrecon and gobuster — a worked example, tool comparison and cheat sheet.

Networking · Intermediate

DNS Explained: How the Domain Name System Works and Its Security

An in-depth exploration of DNS architecture, resolution process, record types, caching, security threats, and privacy protocols like DoH and DoT.

Linux · Beginner

Linux Networking Basics: Commands and Configuration

Essential Linux networking commands and configuration for IP addressing, routing, DNS, firewall rules, and network troubleshooting.

OSINT · Beginner

DNS Enumeration Guide: Complete Domain Reconnaissance

Master DNS enumeration techniques from basic queries to advanced zone transfers, subdomain brute forcing, and DNS security assessment using Kali Linux tools.

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.