dig (Domain Information Groper) is a command-line tool used for querying Domain Name System (DNS) servers. It’s useful for troubleshooting DNS issues or verifying DNS records for a domain.
Common dig Query Types
- A: Retrieves the IPv4 address associated with the domain.
- AAAA: Retrieves the IPv6 address associated with the domain.
- MX: Retrieves the Mail Exchange servers responsible for accepting email for the domain.
- TXT: Retrieves text records associated with the domain (commonly used for verifying domain ownership).
- NS: Retrieves the Name Servers for the domain.
- CNAME: Retrieves the canonical name (alias) for the domain.
Additional Options
- +short: Displays only the concise answer, without extra details.
- +trace: Traces the delegation path from the root servers to the domain’s authoritative DNS servers.
- +all: Displays all available information for the query.
Examples of dig Commands
Query the IPv4 address of example.com.
> dig example.com A
Query the Mail Exchange servers for example.com.> dig example.com MX
Trace the DNS path from the root servers to example.com.> dig example.com +trace
Query the DNS server at 8.8.8.8 (Google Public DNS) for example.com.> dig example.com @8.8.8.8