Home » [SOLVED] Linux DNS Failure: 'Could not resolve host' / systemd-resolved
Systems & Servers

[SOLVED] Linux DNS Failure: 'Could not resolve host' / systemd-resolved

The systemic failure Temporary failure in name resolution, Could not resolve host: google.com or Failed to start Network Name Resolution in Linux occurs when the local domain resolver daemon or /etc/resolv.conf loses valid upstream nameserver configurations, halting outbound network connections requiring hostname resolution.

Quick Diagnostics

Cause
Broken symlink at /etc/resolv.conf pointing to an inactive systemd-resolved stub file
Solution
Recreate symlink pointing to /run/systemd/resolve/stub-resolv.conf or apply static nameservers
Cause
systemd-resolved unit in failed state due to configuration errors or port 53 collision
Solution
Restart daemon with sudo systemctl restart systemd-resolved and declare upstream DNS

Step-by-Step Solution

  1. 1

    Step 1: Restore Immediate Connectivity via Static Nameservers

    If your server cannot fetch packages due to missing nameservers, inject temporary fallback resolvers:

    BASH
    # Direct public Cloudflare and Google nameservers
    echo -e "nameserver 1.1.1.1\nnameserver 8.8.8.8" | sudo tee /etc/resolv.conf
    

    Verify connectivity:

    BASH
    ping -c 3 google.com
    
  2. 3

    Step 3: Configure Upstream Resolvers in resolved.conf

    Open your master configuration file (/etc/systemd/resolved.conf):

    INI
    [Resolve]
    DNS=1.1.1.1 8.8.8.8
    FallbackDNS=1.0.0.1 8.8.4.4
    Domains=~.
    DNSSEC=allow-downgrade
    

    Restart daemon to load new nameserver bindings:

    BASH
    sudo systemctl restart systemd-resolved
    
  3. 4

    Step 4: Verify Resolution State with resolvectl

    Confirm that active network interfaces hold valid DNS assignments:

    BASH
    # Query active DNS resolver telemetry
    resolvectl status
    

❓ Frequently Asked Questions (FAQ)

Why does ping 8.8.8.8 succeed while ping google.com fails?

Because low-level IP routing is functional, but the Application layer hostname-to-IP translation (DNS) subsystem is offline.

What is the role of 127.0.0.53 in resolv.conf?

127.0.0.53 is the local stub listener managed by systemd-resolved to provide local caching and DNSSEC validation.

Prevention Advice

Recommended security practices:

  • Prevent NetworkManager collisions: Ensure NetworkManager delegates DNS lookups to systemd-resolved by adding dns=systemd-resolved in /etc/NetworkManager/NetworkManager.conf.
  • Lock resolv.conf during emergencies: If third-party daemons keep overwriting your configuration, enforce immutability with sudo chattr +i /etc/resolv.conf.
Author • Web Designer & App Creator

Rodolfo Castro

Web designer, app developer, and founder of SoporteCero. Specializing in UI/UX architecture, digital products, and modern web environments (Pixel Digital Dz). Every tutorial and guide on SoporteCero is thoroughly tested and verified in our technical lab to ensure reliable, up-to-date solutions.