resolvectl
Query and manage systemd-resolved DNS settings
TLDR
Show DNS settings
$ resolvectl status
Resolve domain names$ resolvectl query domain1 domain2
Reverse lookup IP address$ resolvectl query 8.8.8.8
Flush DNS caches$ resolvectl flush-caches
Show DNS statistics$ resolvectl statistics
Query MX record for domain$ resolvectl --type MX query domain
Query SRV record$ resolvectl service _xmpp-server._tcp example.com
Query TLS key$ resolvectl tlsa tcp example.com:443
SYNOPSIS
resolvectl [OPTIONS] COMMAND [NAME...]
DESCRIPTION
resolvectl resolves domain names, IPv4 and IPv6 addresses, DNS resource records, and services. It introspects and reconfigures the DNS resolver through systemd-resolved.
PARAMETERS
-4, --ipv4
Query only IPv4 addresses-6, --ipv6
Query only IPv6 addresses-t, --type TYPE
Query specific DNS record type--class CLASS
Query specific DNS class--legend yes|no
Show/hide result legend--cname yes|no
Follow CNAME redirects-p, --protocol
Specify protocol (dns, llmnr, mdns)
COMMANDS
query HOSTNAME|ADDRESS
Resolve hostnames or reverse lookup addressesservice [[NAME] TYPE] DOMAIN
Resolve DNS-SD or SRV serviceopenpgp EMAIL
Query OpenPGP keystlsa [FAMILY] DOMAIN[:PORT]
Query TLS server certificatesstatus [LINK]
Show DNS settings per interfacestatistics
Show resolver statisticsreset-statistics
Reset resolver statisticsflush-caches
Flush all local DNS cachesreset-server-features
Reset learned server featuresdns [LINK [SERVER...]]
Get/set DNS servers per linkdomain [LINK [DOMAIN...]]
Get/set search domains per linkdnssec [LINK [MODE]]
Get/set DNSSEC modenta [LINK [DOMAIN...]]
Get/set DNSSEC negative trust anchors
CAVEATS
This command works with systemd-resolved. If systemd-resolved is not running, many commands will fail. Use flush-caches after making DNS configuration changes.
HISTORY
resolvectl is part of systemd, providing DNS resolution through systemd-resolved. It replaces the older systemd-resolve command.
SEE ALSO
systemd-resolved(8), dig(1), nslookup(1), resolved.conf(5)
