LinuxMid

Host can't resolve names: temporary failure in name resolution

When a Linux host cannot resolve names, check which resolver it uses with resolvectl, test a query, and look for a broken resolv.conf or blocked DNS.

What you see

  • Temporary failure in name resolution from curl, ping or apt
  • IP addresses work but names do not

What it means

Applications ask the system resolver, which asks the DNS servers it is configured with. A failure means the resolver has no working server, cannot reach it, or is handing back a bad answer.

Test with a name and with an IP address first. If the IP works and the name does not, the network is fine and DNS is the problem.

How to confirm the cause

  1. 1
    Show which DNS servers each interface uses
    resolvectl status

    Only applies on hosts running systemd-resolved. Look for an interface with no DNS servers set.

  2. 2
    Run a query through the resolver
    resolvectl query example.com

    Replace with a name you expect to resolve. It shows which server answered, or why it failed.

  3. 3
    Read the classic resolver file
    cat /etc/resolv.conf

    A nameserver line that points at the wrong address, or a missing file, explains the failure.

Causes and fixes

  • No DNS server configured for the interface

    HOW TO TELL
    resolvectl status shows no DNS servers for the active link.
    ROOT CAUSE
    The DHCP lease or the network config did not provide one, so the resolver has nothing to ask.
    FIX
    Set DNS servers in your network configuration, or fix the DHCP option that supplies them.
  • DNS traffic is blocked

    HOW TO TELL
    Servers are configured but queries time out.
    ROOT CAUSE
    A firewall, security group or network ACL blocks outbound DNS to the resolver.
    FIX
    Allow DNS (UDP and TCP 53) to the resolver, or use the cloud provider's internal resolver.
  • Stale or wrong cache

    HOW TO TELL
    One name fails while others work, or an old address is returned.
    ROOT CAUSE
    The local resolver cached a bad or outdated answer.
    FIX
    Flush the cache and query again.
    sudo resolvectl flush-caches

How to stop it coming back

  • Monitor DNS resolution from the host as a synthetic check.
  • Use at least two resolvers.
  • Keep resolver settings in configuration management.

Keep going

Sources

Linux man-pages (man7.org) and the systemd manual (freedesktop.org), read 18 Nov 2026. Command options were checked against those pages.

Search

Search cheat sheets and projects