resolvectl(1)
Resolve hostnames, IP addresses, resource records, and services using systemd-resolved.
Synopsis
resolvectl [OPTION...] {COMMAND} [NAME|ADDRESS]...Description
resolvectl is a command-line tool for querying the DNS resolver service managed by systemd-resolved. It allows you to look up hostnames, reverse-resolve IP addresses, query DNS records, and inspect resolver configuration and statistics.
Results are shown for all configured DNS servers and link-specific settings. The tool can display detailed information about which DNS server answered each query and how long lookups took.
Common options
| Flag | What it does |
|---|---|
-4 | Query IPv4 addresses only (A records) |
-6 | Query IPv6 addresses only (AAAA records) |
-i INTERFACE | Query using a specific network interface |
-p PROTOCOL | Restrict queries to specified protocol (dns, llmnr, mdns) |
-t TYPE | Query specific DNS record type (A, AAAA, MX, NS, TXT, SOA, etc.) |
-c CLASS | Query specific DNS class (IN, CH, HS) |
--no-pager | Do not pipe output into a pager |
--legend=yes|no | Show or hide headers and legend information |
-j, --json=short|pretty | Output results in JSON format |
--statistics | Show resolver cache statistics and hit rates |
Examples
Resolve hostname to IPv4 and IPv6 addresses using all configured DNS servers
resolvectl query example.comResolve hostname to IPv4 addresses only
resolvectl -4 query google.comPerform reverse DNS lookup on IP address 8.8.8.8
resolvectl reverse 8.8.8.8Query mail exchange (MX) records for a domain
resolvectl query example.com -t MXQuery text (TXT) records for a domain, useful for SPF and DKIM checks
resolvectl query example.com -t TXTDisplay DNS resolver configuration and status for all network interfaces
resolvectl statusShow DNS cache statistics including total queries and cache hit rate
resolvectl statisticsResolve hostname using DNS servers configured for eth0 interface only
resolvectl -i eth0 query example.com