dns utility is a command-line tool for querying DNS servers directly. It supports both UDP and TLS connections, DNSSEC validation, and querying multiple resource record types.
Usage
Options
--server, -s <addr>- The address of the DNS server to query (required)--ca-certs, -C <file>- Path to a root CA certificate file for TLS--tls- Use TLS to connect to the server (uses port 853)--dnssec- Validate DNSSEC records locally
Query format
Queries can be specified in two formats:- Simple format:
<name>- Queries ANY record type for the given name - Explicit format:
<rr,rr,...>@<name>- Queries specific record types
Supported record types
A- IPv4 addressAAAA- IPv6 addressCNAME- Canonical nameMX- Mail exchangeTXT- Text recordsNS- Name serverSOA- Start of authorityPTR- Pointer recordSRV- Service locatorANY- All available records
Examples
Basic DNS query
Query all records for a domain:Query specific record types
Query A and AAAA records:DNS over TLS
Query using DNS-over-TLS (DoT):DNSSEC validation
Validate DNSSEC signatures:Multiple queries
Query multiple domains in one command:Implementation details
The DNS utility is built on:- LibDNS: DNS protocol implementation
- LibCore: Event loop and socket handling
- LibTLS: TLS support for DNS-over-TLS
~/workspace/source/Utilities/dns.cpp
When using TLS, the default port is 853. For UDP connections, port 53 is used.