π ~1 min read
Table of contents
Symptom & Impact
Hostnames fail to resolve even though direct IP pings succeed.
Environment & Reproduction
Can occur after resolver changes, VPN setup, or DHCP lease renewal.
cat /etc/os-release
ping -c 2 1.1.1.1
getent hosts debian.org
Root Cause Analysis
Resolver configuration points to unreachable or invalid DNS servers.
Quick Triage
Check resolver status and active nameserver list.
cat /etc/resolv.conf
resolvectl status
systemctl status systemd-resolved --no-pager
Step-by-Step Diagnosis
Test individual nameservers and inspect DNS query failures.
dig @1.1.1.1 debian.org +short
dig @$(awk '/nameserver/{print $2;exit}' /etc/resolv.conf) debian.org +short
journalctl -u systemd-resolved --since '30 min ago'

Solution – Primary Fix
Set reliable DNS servers and restart resolver services.
Still having issues? Our Network Design team can diagnose and resolve this for you. Get in touch for a free consultation.
sudo resolvectl dns eth0 1.1.1.1 8.8.8.8
sudo systemctl restart systemd-resolved
sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

Solution – Alternative Approaches
Configure static nameservers in ifupdown or NetworkManager profiles.
sudoedit /etc/network/interfaces
# add dns-nameservers 1.1.1.1 8.8.8.8
sudo systemctl restart networking
Verification & Acceptance Criteria
DNS lookups return expected records and application connectivity is restored.
getent hosts debian.org
ping -c 2 debian.org
apt update
Rollback Plan
Restore prior resolver configuration if service-specific DNS breaks.
sudo cp /root/resolv.conf.bak /etc/resolv.conf
sudo systemctl restart systemd-resolved
Prevention & Hardening
Standardize DNS policies and monitor resolver health metrics.
resolvectl statistics
systemctl is-active systemd-resolved
Related Errors & Cross-Refs
Related messages include temporary failure in name resolution and SERVFAIL.
Related tutorial: View the step-by-step tutorial for Debian 12.
View all Debian 12 tutorials on the Tutorials Hub β
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
systemd-resolved and Debian DNS configuration documentation.
Need Expert Help?
If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today β we respond within one business day.