DNS — names to addresses, and the caches that lie
"It pings by IP but not by name" is always DNS. The answer can come from five layers, and each one caches — including the answer 'no'.
n -h dnsWhat the check does. Resolves a well-known name (one.one.one.one) and times it. Green means your resolver answers; red means names don't work even though the internet ([wan](wan)) might.
Where an answer can come from
1. The hosts file — checked first, wins over everything. n host . audits it.
2. The OS cache — ipconfig /displaydns, resolvectl statistics.
3. Your configured resolver — the router, the ISP, a VPN's resolver, or a DoH provider. *This is the layer that usually surprises people:* a VPN client silently replaces it.
4. LAN name protocols — mDNS (.local), NetBIOS/LLMNR (Windows names). Linux doesn't speak NetBIOS by default, which is why ping White fails on Linux and works on Windows.
5. Authoritative DNS — the real answer, at the domain's own nameservers.
n resolve <host> asks all of them and shows where they disagree.
Negative caching — the one that bites
Resolvers cache "that name doesn't exist" just as faithfully as real answers, for the zone's negative TTL (often 30 minutes). Ask for a name *before* its record exists — a new domain, a new host — and you'll keep getting "no" long after it's live, while the rest of the world sees it fine. Flush: ipconfig /flushdns, sudo resolvectl flush-caches, sudo dscacheutil -flushcache. If a VPN or router resolver holds it, switch resolver or wait it out. n flush . does the local part, with a warning first.
Fixes, in order
- Red DNS, green WAN → try
nslookup example.com 1.1.1.1. Works? Your configured resolver is the problem: change it (adapter settings, or the router's DHCP). - Wrong address for a LAN name → stale cache or a stale hosts entry;
n resolve <name>shows which.