systemd-resolve(1)
Resolve domain names, IPv4/IPv6 addresses, and DNS records using systemd's resolver service.
Synopsis
systemd-resolve [OPTIONS...] NAME... | systemd-resolve [OPTIONS...] --service [[NAME] TYPE DOMAIN] | systemd-resolve [OPTIONS...] --statistics | systemd-resolve [OPTIONS...] --reset-statistics | systemd-resolve [OPTIONS...] --flush-cachesDescription
systemd-resolve is a command-line tool for resolving domain names and IP addresses using the systemd DNS resolver. It queries the system's resolver configuration, which can use multiple DNS servers, DNSSEC validation, and local hostname resolution.
This tool is useful for debugging DNS issues, checking resolver status, and performing ad-hoc DNS lookups. It integrates with systemd-resolved, the system's DNS caching resolver daemon.
Common options
| Flag | What it does |
|---|---|
-4 | Resolve IPv4 addresses only |
-6 | Resolve IPv6 addresses only |
-t TYPE | Query specific DNS record type (A, AAAA, MX, SRV, TXT, etc.) |
-c CLASS | Query specific DNS class (IN for internet, CH for chaos, etc.) |
--service | Resolve SRV service discovery records |
--statistics | Show resolver statistics and cache information |
--reset-statistics | Reset resolver statistics counters |
--flush-caches | Clear the DNS resolver cache |
-p PROTOCOL | Query via specific protocol (udp, tcp, udp-or-tcp) |
--no-dnssec | Disable DNSSEC validation for the query |
Examples
Resolve the domain name google.com to its IP address
systemd-resolve google.comQuery MX (mail exchanger) records for gmail.com
systemd-resolve -t MX gmail.comLook up DMARC TXT record for email domain authentication
systemd-resolve -t TXT _dmarc.example.comDisplay resolver cache hits, misses, and current statistics
systemd-resolve --statisticsDiscover HTTP services available on example.com using SRV records
systemd-resolve --service _http._tcp example.comResolve example.com to IPv4 address only (skip IPv6)
systemd-resolve -4 example.comClear the DNS cache without restarting systemd-resolved
systemd-resolve --flush-cachesPerform reverse DNS lookup to find hostname for IP address
systemd-resolve 8.8.8.8