NETLEARN
Lesson 02Name & Address

DNS Cache & TTL

A full resolution is expensive (five servers, many round-trips). DNS solves this by storing answers for a while, counted down by a number called TTL.

Layer
Layer 7 · Application, port 53
Reference
RFC 1035 / RFC 8767
Steps
6
Clientbrowser
Resolverrecursive (ISP)
Authoritativens.example.com
legendrequestresponsecontrolmessage in flight

Common misunderstandings

  • The DNS cache on your computer can hold changes back too. If a site moved to a new IP but you're still hitting the old one, clear your local cache.

Key notes

High vs low TTL
A high TTL saves queries but changes spread slowly; a low TTL is the reverse. Many domain owners lower the TTL before migrating.
Negative caching
A "not found" answer (NXDOMAIN) is cached too, so a wrong name isn't asked over and over.
Layered
The browser, OS, router, and resolver each have their own cache. The answer can come from any of them.
Serve-stale
When a resolver fails to answer, some serve an expired old answer to avoid an error.