Linux resolvectl Command: Inspect systemd DNS Resolution

resolvectl checks the DNS servers used by systemd-resolved, per-link domain settings, and name resolution results. It is used when investigating DNS issues in a systemd-resolved environment.

Each link can use different DNS servers or search domains, and split DNS can be applied with VPNs. status shows overall and per-link settings, while query shows name resolution results via resolved. This tool does not apply to systems that do not use systemd-resolved.

Basic syntax

resolvectl [command] [name or link]

Installed implementations and options may vary depending on the distribution. Check the description of the current system with man resolvectl.

Examples

Checking DNS settings

Reads DNS server and domain information for both the whole system and per-interface.

resolvectl status

Name resolution test

Checks how domains are resolved through the current resolved path.

resolvectl query example.com

Check query statistics

Look at cache and processing related statistics.

resolvectl statistics

Distinguishing System DNS and Interface DNS

resolvectl status shows the DNS servers, domains, and per-interface settings managed by systemd-resolved.

resolvectl status

Part of the example output (server addresses are for illustration purposes):

Global
    Current DNS Server: 192.0.2.53
Link 2 (eth0)
    DNS Servers: 192.0.2.53

If global settings and per-link settings exist simultaneously, the server actually used for a query can vary according to domain routing rules. Check the query result with resolvectl query example.com. On distributions that do not use systemd-resolved, the command may not exist or may not match the current DNS configuration.

Main Options and Format

Options/Format Description
status Display DNS settings per link or overall.
query name Resolve a host name or address.
statistics Display DNS query statistics.
dns [link] Check or set DNS servers per link.
domain [link] Check or set the search and routing domains.
flush-caches Clear the DNS cache. This affects diagnostic results.

Precautions when using

If you change settings like resolvectl dns interface server, the DNS query path may change, so distinguish between querying and changing. NetworkManager or DHCP may overwrite the values again. Do not judge the entire split DNS policy based solely on the contents of /etc/resolv.conf.

Frequently Asked Questions

What if the resolvectl command is missing or does not work?

The system in use may not use systemd-resolved. First, check how the actual DNS management service is connected to /etc/resolv.conf.

Official Documentation

You can check the exact behavior of options and implementation differences in the official resolvectl documentation.