Caching and queries
Query DNS with dig
Ask for one record type, use a chosen resolver, and read the answer, status, flags, and remaining TTL.
8 minute lesson
The dig command gives you a direct view of a DNS response.
Ask for an address record:
dig A flaviocopes.com
Read the complete response before shortening it. The header contains evidence such as:
status:NOERROR,NXDOMAIN,SERVFAIL, or another result code- flags:
aameans the answer is authoritative, whilerasays recursion is available ANSWER: records that answer the questionAUTHORITY: delegation or authority information, including the SOA for negative answersSERVER: the resolver that repliedQuery time: how long this request took
The number beside a returned record is its remaining TTL in seconds. A recursive resolver decrements this value while the answer is cached.
NOERROR does not guarantee that the answer section contains the requested type. The name may exist without an A record.
Use +short only when you need values for a script or quick check. It hides the status, flags, authority section, and server:
dig A flaviocopes.com +short
Add a resolver after @ when you want to compare caches:
dig @1.1.1.1 A flaviocopes.com +short
dig @8.8.8.8 A flaviocopes.com +short
For focused evidence without losing record TTLs, select sections explicitly:
dig A flaviocopes.com +noall +answer +comments
If two resolvers disagree after a change, compare their remaining TTLs and then query an authoritative server. Repeatedly refreshing your browser tells you much less.
Your action is to run one full dig query and annotate the status, flags, answer, TTL, responding server, and query time. Then run +short and list the evidence it removed.
Lesson completed