Notes That Expire — Web Fundamentals

A DNS answer is kept in a cache (a note kept for a short time) and has an age limit, called the TTL. Until that time has passed, the IP address comes from the…

Asking along the chain takes time. Luckily a DNS answer (the IP address of a domain name) may be kept for a while. So the same question does not have to start from the root server again.

Kept, but with an age limit

Once they have an answer, the browser, the phone and the resolver keep it in a cache: a note kept for a short time. If you open myshop.com again a minute later, its IP address comes directly from that note, without asking any server.

Every DNS answer carries an age limit, called its TTL (time to live), for example 5 minutes. Until that time has passed, the note is used. After that, the note is thrown away, and for the next question the resolver has to ask along the chain again.

This is why a move to a new server is not noticed right away. If MyShop moves to a new IP address, a phone that still keeps the old note goes to the old IP address until that note expires (its age limit has passed).

TL;DR: A DNS answer is kept in a cache (a note kept for a short time) and has an age limit, called the TTL. Until that time has passed, the IP address comes from the note. After that, the browser asks DNS again. So after a server moves to a new IP address, the old note is still used for a while.

⚡ The answer is kept

Guess first: a DNS answer may be kept for a while. You open myshop.com again a minute later. Does the resolver have to ask along the chain again?

No. The IP address comes directly from the answer that was kept, without asking any server.

Meaning: The browser, the phone and the resolver keep a DNS answer in a cache: a note kept for a short time. This way the same question does not have to start from the root server again.

⚡ Its age limit is the TTL

Meaning: Every DNS answer carries an age limit, called its TTL (time to live), for example 5 minutes. Until that time has passed, the note in the cache is used. After that, the note is thrown away, and for the next question the resolver has to ask along the chain again.

⚡ A move does not show at once

Guess first: MyShop moves to a new IP address. Where does a phone that still keeps the old note go?

To the old IP address, until that note expires (its age limit has passed).

Meaning: That is why a move to a new IP address is not noticed right away: each phone asks DNS again only after the age limit of its note has passed.

What you will learn