A modern DNS lookup utility written in Rust that serves as a drop-in replacement for the traditional dig
command. DUG provides fast, reliable DNS queries with a familiar interface and enhanced features.
- Full
dig
compatibility: Supports the same command-line interface and output format - Multiple record types: A, AAAA, MX, NS, SOA, TXT, CNAME, PTR, SRV, CAA, and more
- Query classes: IN (Internet), CH (Chaos), HS (Hesiod)
- Advanced querying:
- Trace queries (
+trace
) for step-by-step resolution - Reverse DNS lookups (
-x
) - Batch file processing (
-f
) - TCP and UDP support
- Trace queries (
- Flexible output:
- Short format (
+short
) - Customizable section display
- Colored output for better readability
- Short format (
- Network options:
- IPv4/IPv6 preference
- Custom timeouts and retry logic
- Source address binding
- Performance: Built with Rust for speed and memory safety
- Cross-platform: Works on Linux, macOS, and Windows
# Clone the repository
git clone https://github.com/blackstar257/dug.git
cd dug
# Build and install
cargo build --release
cargo install --path .
cargo install dug
Download the latest release from the releases page.
# Query A record for a domain
dug example.com
# Query specific record type
dug example.com MX
# Query with specific DNS server
dug @8.8.8.8 example.com
# Short output format
dug +short example.com
# Trace query path
dug +trace example.com
# Reverse DNS lookup
dug -x 8.8.8.8
# TCP query
dug +tcp example.com
# Query with timeout
dug +time=10 example.com
# IPv6 only
dug -6 example.com AAAA
# Process multiple queries from file
dug -f queries.txt
Example queries.txt
:
example.com A
google.com MX
@8.8.8.8 cloudflare.com
+short reddit.com
# Hide specific sections
dug +noquestion +noauthority example.com
# Show only answers
dug +noall +answer example.com
# Disable comments
dug +nocomments example.com
Flag | Description |
---|---|
-4 |
Use IPv4 only |
-6 |
Use IPv6 only |
-b ADDRESS |
Set source IP address |
-c CLASS |
Set query class (IN, CH, HS) |
-f FILENAME |
Read queries from batch file |
-h |
Show help information |
-k FILENAME |
TSIG key file |
-p PORT |
Set port number |
-q NAME |
Set query name |
-t TYPE |
Set query type |
-x ADDR |
Reverse lookup |
-y KEY |
TSIG key |
Option | Description |
---|---|
+[no]tcp |
Use TCP instead of UDP |
+[no]short |
Short output format |
+[no]trace |
Trace delegation path |
+[no]recurse |
Enable/disable recursion |
+[no]dnssec |
Request DNSSEC validation |
+[no]question |
Show/hide question section |
+[no]answer |
Show/hide answer section |
+[no]authority |
Show/hide authority section |
+[no]additional |
Show/hide additional section |
+[no]stats |
Show/hide query statistics |
+[no]cmd |
Show/hide command line |
+[no]comments |
Show/hide comment lines |
+time=N |
Set timeout in seconds |
+tries=N |
Set number of tries |
+retry=N |
Set number of retries |
# Check if a website is accessible
dug +short example.com A
# Find mail servers
dug example.com MX
# Check nameservers
dug example.com NS
# Get all DNS records
dug example.com ANY
# Check reverse DNS
dug -x 192.168.1.1
# Trace full resolution path
dug +trace example.com
# Check specific DNS server response
dug @1.1.1.1 example.com
# Test with TCP (useful for large responses)
dug +tcp example.com TXT
# Check DNSSEC validation
dug +dnssec example.com
- Rust 1.70 or later
- Cargo
git clone https://github.com/blackstar257/dug.git
cd dug
cargo build
cargo test
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project uses standard Rust formatting. Run the following before submitting:
cargo fmt
cargo clippy
- trust-dns-resolver: DNS resolution library
- trust-dns-proto: DNS protocol implementation
- clap: Command-line argument parsing
- tokio: Async runtime
- anyhow: Error handling
- chrono: Date and time handling
- colored: Terminal output coloring
Feature | dig | dug | Notes |
---|---|---|---|
Basic queries | β | β | Full compatibility |
Record types | β | β | All common types supported |
Trace queries | β | β | Step-by-step resolution |
Batch files | β | β | Process multiple queries |
Output formats | β | β | Short and full formats |
Performance | β‘ | β‘β‘ | Rust provides better performance |
Memory usage | π | π | Lower memory footprint |
Cross-platform | β | β | Works on all major platforms |
- AXFR (zone transfer) queries are not yet implemented
- Some advanced TSIG features are in development
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by the original
dig
utility from ISC BIND - Built with the excellent Rust DNS libraries from the trust-dns project
- Thanks to the Rust community for their amazing ecosystem
- π Bug Reports: Issues
- π‘ Feature Requests: Discussions
- π§ Email: your-email@example.com
DUG - Making DNS queries fast, reliable, and modern with Rust π¦