DNS: /etc/hosts, resolv.conf, dig
Sign in to read this lesson
When the IP pings but the name does not, it is almost always a DNS problem. In this lesson we learn how Linux turns a name into an address (hosts, systemd-resolved), why resolv.conf shows 127.0.0.53, checking records with dig, and diagnosing DNS step by step.
What you will learn
- The lookup order is in
/etc/nsswitch.conf: first/etc/hosts, then DNS. - On Ubuntu
systemd-resolvedis a local caching resolver:resolv.confshows127.0.0.53, the real servers are inresolvectl status. dig itnuvo.com— a detailed answer to a DNS query;dig +short,dig @1.1.1.1,dig -x IP,dig MX.- Record types:
A,AAAA,CNAME,MX,TXT,NS,PTR;TTL— how long it stays in caches. getent hosts namegives the system's own answer (hosts + DNS) — this is what applications see.
The lesson has 5 key points, an explanation and 5 questions. It opens with a package.