Shared server guidance · Question & answer

How do I inspect the DNS servers used by systemd-resolved?

On systems that use systemd-resolved, resolvectl shows more than the nameserver line in resolv.conf. DNS can be selected per network interface or routing domain, especially with VPNs and private networks. Inspect the active policy before changing a resolver address.

IntermediateLinux servers running systemd-resolvedCommon Ubuntu configurations; other distributions vary
Go to the answer

Before you start

  • Confirm that systemd-resolved manages DNS on this installation.

Instructions

1. Check resolver status

Review global settings and each link. A local stub such as 127.0.0.53 in resolv.conf is an intermediary, not necessarily the upstream DNS server.

Remote Linux shell
resolvectl status

Reports upstream DNS servers, selected links and configured search or routing domains.

2. Ask the active resolver

Use the exact application hostname and note the interface and protocol in the result. Compare with the system’s intended private or public DNS policy.

Remote Linux shell
resolvectl query app.example.com

Uses systemd-resolved and displays how the lookup was resolved.

3. Check managed-file ownership

Inspect the resolver file’s link target before considering any edit. NetworkManager, systemd-networkd or cloud provisioning can regenerate it, so persistent changes belong in the active network manager’s supported configuration.

Remote Linux shell
ls -l /etc/resolv.conf
readlink -f /etc/resolv.conf

Shows whether resolv.conf points to a generated systemd file. No file is modified.

Check the result

  • Queries return the intended address through the appropriate network link.
  • The resolver settings survive a normal network-manager refresh because they are configured at the correct layer.

Troubleshooting

resolvectl cannot connect to the service
This machine may use another resolver manager. Inspect the actual network stack and resolv.conf instead of installing or enabling a new service as a quick fix.

Official references

Use the documentation for your installed version when a flag, service name or platform feature differs.