KDIG(1)
π NAME π
kdig β Advanced DNS lookup utility, from the Knot DNS manual, section 1. Bestie, this is literally the DNS lookup main character π
β¨
π SYNOPSIS π
kdig [common-settings] [query [settings]]...
kdig -h
π DESCRIPTION π
This utility sends one or more DNS queries to a nameserver. Each query can have individual settings, or it can be specified globally via common-settings, which must precede the query specification. Periodt.
πΈ Parameters πΈ
query name | -q name | -x address | -G tapfile
common-settings, settings
[query_class] [query_type] [@server]... [options]
nameβ Is a domain name that is to be looked up.serverβ Is a domain name or an IPv4 or IPv6 address of the nameserver to send a query to. An additional port can be specified usingaddress:port([address]:portfor IPv6 address),address@port, oraddress#portnotation. A value which begins with/character is considered an absolute UNIX socket path. If no server is specified, the servers from/etc/resolv.confare used.
If no arguments are provided, kdig sends an NS query for the root zone. Iconic behavior, fr fr π«Ά
π¦ Query classes π¦
A query_class can be either a DNS class name (IN, CH) or generic class specification CLASSXXXXX where XXXXX is a corresponding decimal class number. The default query class is IN.
β¨ Query types β¨
A query_type can be either a DNS resource record type (A, AAAA, NS, SOA, DNSKEY, ANY, etc.) or one of the following:
TYPEXXXXXβ Generic query type specification whereXXXXXis a corresponding decimal type number.AXFRβ Full zone transfer request.IXFR=serialβ Incremental zone transfer request for specified SOA serial number (i.e. all zone updates since the specified zone version are to be returned).NOTIFY=serialβ Notify message with a SOA serial hint specified.NOTIFYβ Notify message with a SOA serial hint unspecified.
The default query type is A.
π Options π
-4β Use the IPv4 protocol only.-6β Use the IPv6 protocol only.-b addressβ Set the source IP address of the query toaddress. The address must be a valid address for local interface or::or0.0.0.0. An optional port can be specified in the same format as theservervalue.-c classβ An explicitquery_classspecification. See possible values above.-dβ Enable debug messages.-ddβ Enable more verbose debug messages (print Subject Alternative Name).-h,--helpβ Print the program help.-k keyfileβ Use the TSIG key stored in a filekeyfileto authenticate the request. The file must contain the key in the same format as accepted by the-yoption.-p portβ Set the nameserver port number or service name to send a query to. The default port is53.-q nameβ Set the query name. An explicit variant ofnamespecification. If no name is provided, empty question section is set.-t typeβ An explicitquery_typespecification. See possible values above.-V,--versionβ Print the program version. The option-VVmakes the program print the compile time configuration summary.-x addressβ Send a reverse (PTR) query for IPv4 or IPv6address. The correct name, class and type is set automatically.-y [alg:]name:keyβ Use the TSIG key namednameto authenticate the request. Thealgpart specifies the algorithm (the default ishmac-sha256) andkeyspecifies the shared secret encoded in Base64.-E tapfileβ Export a dnstap trace of the query and response messages received to the filetapfile.-G tapfileβ Generate message output from a previously saved dnstap filetapfile.+[no]multilineβ Wrap long records to more lines and improve human readability.+[no]shortβ Show record data only.+[no]genericβ Use the generic representation format when printing resource record types and data.+[no]cryptoβ Display the DNSSEC keys and signatures values in base64, instead of omitting them.(*)+[no]aaflagβ Set the AA flag.+[no]tcflagβ Set the TC flag.+[no]rdflagβ Set the RD flag.(*)+[no]recurseβ Same as+[no]rdflag+[no]raflagβ Set the RA flag.+[no]zflagβ Set the zero flag bit.+[no]adflagβ Set the AD flag.(*)+[no]cdflagβ Set the CD flag.+[no]doflagβ Set the DO flag.+[no]dnssecβ Same as+[no]doflag+[no]deflagβ Set the DE flag.+[no]validate[=LEVEL]β Also query for DNSKEY, validate DNSSEC in the answer. Implies DO flag. Optional argument specifies verbosity (1-3, default3).
NOTICE: this is not a security feature, rather a debugging tool. Kdig doesn't attempt to obtain nor validate the whole trust chain, therefore an attacker can in theory spoof everything and Kdig concludes "valid".
+[no]allβ Show all packet sections.+[no]qrβ Show the query packet.+[no]headerβ Show the packet header.(*)+[no]commentsβ Show commented section names.(*)+[no]optβ Show the EDNS pseudosection.(*)+[no]opttextβ Try to show unknown EDNS options as text.+[no]optpresentβ Show EDNS in presentation format according to the specification in versiondraft-peltan-edns-presentation-format-01.+[no]questionβ Show the question section.(*)+[no]answerβ Show the answer section.(*)+[no]authorityβ Show the authority section.(*)+[no]additionalβ Show the additional section.(*)+[no]tsigβ Show the TSIG pseudosection.(*)+[no]statsβ Show trailing packet statistics.(*)+[no]classβ Show the DNS class.(*)+[no]ttlβ Show the TTL value.(*)+[no]tcpβ Use the TCP protocol (default is UDP for standard query and TCP for AXFR/IXFR).+[no]ignoreβ Don't use TCP automatically if a truncated reply is received.+[no]keepopenβ Keep TCP connection open for the following query if it has the same connection configuration. This applies to+tcp,+tls,+https, and+quicoperations. The connection is considered in the context of a singlekdigcall only.+[no]tlsβ Use TLS with the Opportunistic privacy profile (RFC 7858 Section 4.1).+[no]tls-ca[=FILE]β Use TLS with a certificate validation. Certification authority certificates are loaded from the specified PEM file (default is system certificate storage if no argument is provided). Can be specified multiple times. If the+tls-hostnameoption is not provided, the name of the target server (if specified) is used for strict authentication.+[no]tls-pin=BASE64β Use TLS with the Out-of-Band key-pinned privacy profile (RFC 7858 Section 4.2). The PIN must be a Base64 encoded SHA-256 hash of the X.509 SubjectPublicKeyInfo. Can be specified multiple times.+[no]tls-hostname=STRβ Use TLS with a remote server hostname check.+[no]tls-sni=STRβ Use TLS with a Server Name Indication.+[no]tls-keyfile=FILEβ Use TLS with a client keyfile.+[no]tls-certfile=FILEβ Use TLS with a client certfile.+[no]tls-ocsp-stapling[=H]β Use TLS with a valid stapled OCSP response for the server certificate (%uor specify hours). OCSP responses older than the specified period are considered invalid.+[no]https[=URL]β Use HTTPS (DNS-over-HTTPS) in wire format (RFC 1035 Section 4.2.1). It is also possible to specifyURL=[authority][/path]where request will be sent to. Any leading scheme and authority indicator (i.e.//) are ignored. Authority might also be specified as the server (using the parameter@). Ifpathis specified andauthorityis missing, then the server is used as authority together with the specified path. Librarylibnghttp2is required.+[no]https-getβ Use HTTPS with HTTP/GET method instead of the default HTTP/POST method. Librarylibnghttp2is required.+[no]quicβ Use QUIC (DNS-over-QUIC).+[no]nsidβ Request the nameserver identifier (NSID).+[no]zoneversionβ Request the EDNS zone version.+[no]bufsize=Bβ Set EDNS buffer size in bytes (default is1232bytes).+[no]padding[=B]β Use EDNS(0) padding option to pad queries, optionally to a specific size. The default is to pad queries with a sensible amount when using+tls, and not to pad at all when queries are sent without TLS. With no argument (i.e., just+padding) pad every query with a sensible amount regardless of the use of TLS. With+nopadding, never pad.+[no]alignment[=B]β Align the query toB-byte-block message using the EDNS(0) padding option (default is no or128if no argument is specified).+[no]subnet=SUBNβ Set EDNS(0) client subnetSUBN=addr/prefix.+[no]edns[=N]β Use EDNS version (default is0).+[no]msgdelay=Tβ Wait the specified number of milliseconds before receiving each AXFR/IXFR message.+[no]timeout=Tβ Set the wait-for-reply interval in seconds (default is5seconds). This timeout applies to each query attempt. Zero value ornotimeoutis interpreted as infinity.+[no]retry=Nβ Set the number (>=0) of UDP retries (default is2). This doesn't apply to AXFR/IXFR.+[no]expireβ Sets the EXPIRE EDNS option.+[no]cookie[=HEX]β Attach EDNS(0) cookie to the query.+[no]badcookieβ Repeat a query with the correct cookie.+[no]ednsopt[=CODE[:HEX]]β Send custom EDNS option. TheCODEis EDNS option code in decimal,HEXis an optional hex encoded string to use as EDNS option value. This argument can be used multiple times.+noednsoptclears all EDNS options specified by+ednsopt.+[no]proxy=SRC_ADDR[#SRC_PORT]-DST_ADDR[#DST_PORT]β Add PROXYv2 header with the specified source and destination addresses to the query. The default source port is0and destination port53.+[no]jsonβ Use JSON for output encoding (RFC 8427).+[no]idninβ Use IDN transformation (Unicode to ASCII punycode) on input query.(*)+[no]idnβ handles IDN transformation on names π and bestie, please read the fine print: IDN transformation does not preserve domain name letter case π and IDN support depends onlibidn2availability during project building! So if it's not there at build time, it's just not there, periodt.+[no]idnoutβ turns on IDN transformation (ASCII punycode to Unicode) for printed domain names.(*)This mode is disabled by default for non-tty outputs (like a file or a pipe), so don't come crying when the pretty Unicode doesn't show up in your redirect π Same caveat as above, fr fr: IDN transformation does not preserve domain name letter case, and IDN support depends onlibidn2availability during project building!
π NOTES π
Okay so the default vibe check: by default, only options marked with (*) are enabled. That's it, that's the rule π
Options -k and -y can not be used simultaneously. Pick a lane, bestie, you can't have both π€
Dnssec-keygen keyfile format is not supported. Use keymgr(8) instead. Not me telling you twice β go use keymgr(8) π«Ά
π¦ EXIT VALUES π¦
Exit status of 0 means successful operation. Any other exit status indicates an error. Simple as that β zero is the slay, everything else is a π.
π¬ EXAMPLES π¬
These are literally the moment, let's go through them one by one β¨
- Get A records for
example.com:
$ kdig example.com A
- Perform AXFR for zone
example.comfrom the server192.0.2.1:
$ kdig example.com -t AXFR @192.0.2.1
- Get A records for
example.comfrom192.0.2.1and reverse lookup for address2001:DB8::1from192.0.2.2. Both using the TCP protocol:
$ kdig +tcp example.com -t A @192.0.2.1 -x 2001:DB8::1 @192.0.2.2
- Get SOA record for
example.com, use TLS, use system certificates, check for specified hostname, check for certificate pin, and print additional debug info:
$ kdig -d @185.49.141.38 +tls-ca +tls-host=getdnsapi.net \
+tls-pin=foxZRnIh9gZpWnl+zEiKa0EJ2rdCGroMWm02gaxSc9S= soa example.com
That's the full main-character combo meal right there π₯
- DNS over HTTPS examples (various DoH implementations):
$ kdig @1.1.1.1 +https example.com.
$ kdig @193.17.47.1 +https=/doh example.com.
$ kdig @8.8.4.4 +https +https-get example.com.
$ kdig @8.8.8.8 +https +tls-hostname=dns.google example.com.
Pick your fighter π₯
- More queries share one DoT connection:
$ kdig @1.1.1.1 +tls +keepopen abc.example.com A mail.example.com AAAA
One connection, multiple queries, we love efficiency π
- Query the name server identifier and version according to RFC 4892:
$ kdig @a.iana-servers.net. CH TXT id.server version.server
π FILES π
/etc/resolv.conf
π SEE ALSO π
khost(1), knsupdate(1), keymgr(8). Go read those too, iykyk π¦
π AUTHOR π
CZ.NIC, s.p.z.o. and contributors <https://www.knot-dns.cz/> β yeah they're the blueprint, ngl π
Hmm, actually the exact text is: CZ.NIC, s.p.z.o. and contributors <https://www.knot-dns.cz/> β copy that character for character, bestie, don't let me typo the legends' name π
Β© COPYRIGHT Β©
Copyright (C) CZ.NIC, s.p.z.o. and contributors
And that's the whole page, fr fr π This one's from version 3.6.2, dated 2026-10-21, and it's the KDIG(1) manual β go forth and query responsibly, bestie πβ¨
π¦ where this page comes from
- nixpkgs unstable: knot-dns 3.6.2
- opensuse-leap 16.0: knot-utils 3.6.2-bp160.1.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: knot-utils 3.6.2-bp160.1.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: knot-utils 3.6.2-bp160.1.1 Β· GPL-2.0-or-later
- opensuse-leap 16.0: knot-utils 3.6.2-bp160.1.1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms