resolvectl Commands Reference
Modern Linux DNS resolver management with systemd-resolved
đ Basic DNS Lookups
Simple domain lookup
resolvectl query example.comPerforms DNS lookup showing A and AAAA records with resolver information.
Reverse DNS lookup
resolvectl query 8.8.8.8Looks up hostname associated with an IP address using PTR records.
Legacy systemd-resolve syntax
systemd-resolve example.comOlder command, still works but deprecated. Use resolvectl instead.
đ Querying Different Record Types
MX records (mail servers)
resolvectl query --type=MX example.comTXT records
resolvectl query --type=TXT example.comQuery TXT records for SPF, DKIM, DMARC, and domain verification.
NS records (nameservers)
resolvectl query --type=NS example.comSOA records (zone authority)
resolvectl query --type=SOA example.comSRV records (service location)
resolvectl query --type=SRV _imaps._tcp.example.comđ Certificate & TLS-Related Lookups
CAA records (Certificate Authority Authorization)
resolvectl query --type=CAA example.comShows which Certificate Authorities are authorized to issue certificates.
TLSA records (DANE)
resolvectl query --type=TLSA _443._tcp.example.comDANE TLSA records bind TLS certificates to DNS names via DNSSEC.
ACME DNS-01 challenge verification
resolvectl query --type=TXT _acme-challenge.example.comVerify DNS-01 challenge TXT record for Let's Encrypt certificate issuance.
MTA-STS policy records
resolvectl query --type=TXT _mta-sts.example.com
resolvectl query --type=TXT _smtp._tls.example.comCheck MTA-STS configuration for email security.
đ DNSSEC Validation
Check DNSSEC validation status
resolvectl query example.comOutput includes DNSSEC validation status (authenticated/not authenticated).
Check global DNSSEC mode
resolvectl status | grep "DNSSEC"Shows if DNSSEC validation is enabled globally (yes/no/allow-downgrade).
Enable DNSSEC for interface
resolvectl dnssec eth0 yesEnable strict DNSSEC validation for specific network interface.
Disable DNSSEC for interface
resolvectl dnssec eth0 nođ Resolver Status and Configuration
View resolver status
resolvectl statusShows DNS servers, search domains, DNSSEC status, and DNS-over-TLS configuration for all interfaces.
View interface-specific status
resolvectl status eth0View resolver statistics
resolvectl statisticsShows cache statistics, query counts, and performance metrics.
Reset statistics
resolvectl reset-statisticsđī¸ Cache Management
Flush DNS cache
resolvectl flush-cachesClears all cached DNS responses. Useful after DNS changes or troubleshooting.
Verify cache flush
resolvectl flush-caches
resolvectl statisticsFlush cache and check statistics to confirm cache is cleared.
đ DNS-over-TLS Configuration
Enable DNS-over-TLS for interface
resolvectl dnsovertls eth0 yesEnforce DNS-over-TLS for all queries on this interface.
Opportunistic DNS-over-TLS
resolvectl dnsovertls eth0 opportunisticUse DNS-over-TLS if available, fallback to plain DNS if not.
Disable DNS-over-TLS
resolvectl dnsovertls eth0 noCheck DNS-over-TLS status
resolvectl status eth0 | grep "DNS over TLS"đ§ Troubleshooting
Check systemd-resolved service status
systemctl status systemd-resolvedVerify the DNS resolution service is running properly.
Restart systemd-resolved
sudo systemctl restart systemd-resolvedRestart the resolver service after configuration changes.
Check resolv.conf symlink
ls -l /etc/resolv.confShould point to /run/systemd/resolve/stub-resolv.conf or /run/systemd/resolve/resolv.conf
View systemd-resolved logs
journalctl -u systemd-resolved -fFollow resolver logs in real-time for debugging.
Monitor DNS queries
resolvectl monitorWatch DNS queries and cache operations in real-time.
Test with specific protocol
# IPv4 only
resolvectl query --protocol=ipv4 example.com
# IPv6 only
resolvectl query --protocol=ipv6 example.comâšī¸ Important Notes
systemd-resolved Integration
resolvectl is the modern interface to systemd-resolved. It replaces the deprecated systemd-resolve command.
Configuration Files
System-wide configuration is in /etc/systemd/resolved.conf. Per-interface settings are managed via NetworkManager or systemd-networkd.
DNS Stub Listener
systemd-resolved provides a local DNS stub on 127.0.0.53:53. Applications should use this via /etc/resolv.conf symlink.
DNSSEC Support
DNSSEC validation is supported but may need explicit enablement. Check your distribution's defaults.
DNS-over-TLS
DNS-over-TLS provides encrypted DNS queries (RFC 7858). Requires upstream DNS server support (Cloudflare 1.1.1.1, Google 8.8.8.8, etc.).
Compatibility
resolvectl is available on systemd-based Linux distributions (Ubuntu 18.04+, Fedora, Arch, etc.). Not available on traditional SysV init systems.