dig
Overview
The dig
(Domain Information Groper) command is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers from the name servers.
Syntax
dig [@server] [name] [type] [options]
Common Options
Option | Description |
---|---|
+short |
Short answer |
+noall |
Set all display flags off |
+answer |
Display answer section |
+norecurse |
Turn off recursive processing |
+trace |
Trace delegation path |
+noquestion |
Don’t show question section |
+nocmd |
Don’t show command line |
+nocomments |
Don’t show comment lines |
-t type |
Set query type |
-x addr |
Reverse lookup |
-p port |
Port number |
-4 |
IPv4 query |
-6 |
IPv6 query |
Key Use Cases
- DNS troubleshooting
- Record verification
- DNS propagation
- DNSSEC validation
- Zone transfers
Examples with Explanations
Example 1: Basic Query
dig google.com
Look up A records
Example 2: Specific Record
dig domain.com MX
Look up mail servers
Example 3: Trace Path
dig +trace domain.com
Show resolution path
Understanding Output
Sections in output: 1. Header (status, flags) 2. Question section 3. Answer section 4. Authority section 5. Additional section
Common Usage Patterns
Short output:
dig +short domain.com
Reverse lookup:
dig -x IP_address
Specific server:
dig @8.8.8.8 domain.com
Performance Analysis
- Query time
- Server response
- Resolution path
- DNSSEC validation
- Answer completeness
Additional Resources
Best Practices
- Use specific queries
- Verify multiple servers
- Check DNSSEC
- Document results
- Compare responses
Troubleshooting
- Resolution failures
- DNSSEC issues
- Propagation delays
- Server problems
- Zone transfers
Query Types
- A (IPv4 address)
- AAAA (IPv6 address)
- MX (Mail exchange)
- NS (Name server)
- SOA (Start of authority)