$linuxjunkies
>

systemd-resolve(1)

Resolve domain names, IPv4/IPv6 addresses, and DNS records using systemd's resolver service.

UbuntuDebianFedoraArch

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-caches

Description

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

FlagWhat it does
-4Resolve IPv4 addresses only
-6Resolve IPv6 addresses only
-t TYPEQuery specific DNS record type (A, AAAA, MX, SRV, TXT, etc.)
-c CLASSQuery specific DNS class (IN for internet, CH for chaos, etc.)
--serviceResolve SRV service discovery records
--statisticsShow resolver statistics and cache information
--reset-statisticsReset resolver statistics counters
--flush-cachesClear the DNS resolver cache
-p PROTOCOLQuery via specific protocol (udp, tcp, udp-or-tcp)
--no-dnssecDisable DNSSEC validation for the query

Examples

Resolve the domain name google.com to its IP address

systemd-resolve google.com

Query MX (mail exchanger) records for gmail.com

systemd-resolve -t MX gmail.com

Look up DMARC TXT record for email domain authentication

systemd-resolve -t TXT _dmarc.example.com

Display resolver cache hits, misses, and current statistics

systemd-resolve --statistics

Discover HTTP services available on example.com using SRV records

systemd-resolve --service _http._tcp example.com

Resolve example.com to IPv4 address only (skip IPv6)

systemd-resolve -4 example.com

Clear the DNS cache without restarting systemd-resolved

systemd-resolve --flush-caches

Perform reverse DNS lookup to find hostname for IP address

systemd-resolve 8.8.8.8

Related commands