KDIG(1) Knot DNS KDIG(1)

kdig - Advanced DNS lookup utility

kdig [common-settings] [query [settings]]...

kdig -h

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 query specification.

name | -q name | -x address | -G tapfile
[query_class] [query_type] [@server]... [options]
Is a domain name that is to be looked up.
Is a domain name or an IPv4 or IPv6 address of the nameserver to send a query to. An additional port can be specified using address:port ([address]:port for IPv6 address), address@port, or address#port notation. A value which begins with '/' character is considered an absolute UNIX socket path. If no server is specified, the servers from /etc/resolv.conf are used.

If no arguments are provided, kdig sends NS query for the root zone.

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.

A query_type can be either a DNS resource record type (A, AAAA, NS, SOA, DNSKEY, ANY, etc.) or one of the following:

Generic query type specification where XXXXX is a corresponding decimal type number.
Full zone transfer request.
Incremental zone transfer request for specified SOA serial number (i.e. all zone updates since the specified zone version are to be returned).
Notify message with a SOA serial hint specified.
Notify message with a SOA serial hint unspecified.

The default query type is A.

Use the IPv4 protocol only.
Use the IPv6 protocol only.
Set the source IP address of the query to address. The address must be a valid address for local interface or :: or An optional port can be specified in the same format as the server value.
An explicit query_class specification. See possible values above.
Enable debug messages.
Print the program help.
Use the TSIG key stored in a file keyfile to authenticate the request. The file must contain the key in the same format as accepted by the -y option.
Set the nameserver port number or service name to send a query to. The default port is 53.
Set the query name. An explicit variant of name specification. If no name is provided, empty question section is set.
An explicit query_type specification. See possible values above.
Print the program version.
Send a reverse (PTR) query for IPv4 or IPv6 address. The correct name, class and type is set automatically.
Use the TSIG key named name to authenticate the request. The alg part specifies the algorithm (the default is hmac-sha256) and key specifies the shared secret encoded in Base64.
Export a dnstap trace of the query and response messages received to the file tapfile.
Generate message output from a previously saved dnstap file tapfile.
Wrap long records to more lines and improve human readability.
Show record data only.
Use the generic representation format when printing resource record types and data.
Display the DNSSEC keys and signatures values in base64, instead of omitting them.
Set the AA flag.
Set the TC flag.
Set the RD flag.
Same as +[no]rdflag
Set the RA flag.
Set the zero flag bit.
Set the AD flag.
Set the CD flag.
Set the DO flag.
Show all packet sections.
Show the query packet.
Show the packet header.
Show commented section names.
Show the EDNS pseudosection.
Try to show unknown EDNS options as text.
Show EDNS in presentation format according to the specification in version draft-peltan-edns-presentation-format-01.
Show the question section.
Show the answer section.
Show the authority section.
Show the additional section.
Show the TSIG pseudosection.
Show trailing packet statistics.
Show the DNS class.
Show the TTL value.
Use the TCP protocol (default is UDP for standard query and TCP for AXFR/IXFR).
Use TCP Fast Open.
Don't use TCP automatically if a truncated reply is received.
Keep TCP connection open for the following query if it has the same connection configuration. This applies to +tcp, +tls, and +https operations. The connection is considered in the context of a single kdig call only.
Use TLS with the Opportunistic privacy profile (RFC 7858#section-4.1).
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-hostname option is not provided, the name of the target server (if specified) is used for strict authentication.
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.
Use TLS with a remote server hostname check.
Use TLS with a Server Name Indication.
Use TLS with a client keyfile.
Use TLS with a client certfile.
Use TLS with a valid stapled OCSP response for the server certificate (%u or specify hours). OCSP responses older than the specified period are considered invalid.
Use HTTPS (DNS-over-HTTPS) in wire format (RFC 1035#section-4.2.1). It is also possible to specify URL=[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 @). If path is specified and authority is missing, then the server is used as authority together with the specified path. Library libnghttp2 is required.
Use HTTPS with HTTP/GET method instead of the default HTTP/POST method. Library libnghttp2 is required.
Use QUIC (DNS-over-QUIC).
Request the nameserver identifier (NSID).
Set EDNS buffer size in bytes (default is 4096 bytes).
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.
Align the query to B-byte-block message using the EDNS(0) padding option (default is no or 128 if no argument is specified).
Set EDNS(0) client subnet SUBN=addr/prefix.
Use EDNS version (default is 0).
Set the wait-for-reply interval in seconds (default is 5 seconds). This timeout applies to each query attempt. Zero value or notimeout is interpreted as infinity.
Set the number (>=0) of UDP retries (default is 2). This doesn't apply to AXFR/IXFR.
Sets the EXPIRE EDNS option.
Attach EDNS(0) cookie to the query.
Repeat a query with the correct cookie.
Send custom EDNS option. The CODE is EDNS option code in decimal, HEX is an optional hex encoded string to use as EDNS option value. This argument can be used multiple times. +noednsopt clears all EDNS options specified by +ednsopt.
Add PROXYv2 header with the specified source and destination addresses to the query. The default source port is 0 and destination port 53.
Use JSON for output encoding (RFC 8427).
Disable the IDN transformation to ASCII and vice versa. IDN support depends on libidn availability during project building! If used in common-settings, all IDN transformations are disabled. If used in the individual query settings, transformation from ASCII is disabled on output for the particular query. Note that IDN transformation does not preserve domain name letter case.

Options -k and -y can not be used simultaneously.

Dnssec-keygen keyfile format is not supported. Use keymgr(8) instead.

Exit status of 0 means successful operation. Any other exit status indicates an error.

Get A records for example.com:
$ kdig example.com A
Perform AXFR for zone example.com from the server
$ kdig example.com -t AXFR @
Get A records for example.com from and reverse lookup for address 2001:DB8::1 from Both using the TCP protocol:
$ kdig +tcp example.com -t A @ -x 2001:DB8::1 @
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 @ +tls-ca +tls-host=getdnsapi.net \
  +tls-pin=foxZRnIh9gZpWnl+zEiKa0EJ2rdCGroMWm02gaxSc9S= soa example.com
DNS over HTTPS examples (various DoH implementations):
$ kdig @ +https example.com.
$ kdig @ +https=/doh example.com.
$ kdig @ +https +https-get example.com.
$ kdig @ +https +tls-hostname=dns.google +fastopen example.com.
More queries share one DoT connection:
$ kdig @ +tls +keepopen abc.example.com A mail.example.com AAAA


khost(1), knsupdate(1), keymgr(8).

CZ.NIC Labs https://www.knot-dns.cz

Copyright 2010–2024, CZ.NIC, z.s.p.o.

2024-06-12 3.3.6