5 min read
Module 1 of 2, lesson 2 of 2. 0 of 5 lessons done.
Finding sites: DNS and caching
From a name to a number
Here is a puzzle. You type an address like a website name, made of words. But packets need a numeric IP address to find their way. So how does the name made of words become a number?
The answer is a system that works like a phonebook for the internet. You know someone's name, and the phonebook gives you their number. In the same way, this system takes the readable name you typed and looks up the matching IP address. Its name is the Domain Name System, usually shortened to DNS.
Without this step, nothing else can happen. The name you type is easy for a person to remember but means nothing to the machines that move your packets. DNS is the translation that turns the name you can read into the number the network can route.
The lookup chain
Looking up the number happens in a short chain of questions, handled by a helper called a resolver:
- Your computer asks the resolver, "what is the IP address for this name?"
- The resolver first asks a top-level directory, a root server, "where do I find names with this ending?" and is pointed to the right directory for that ending, for example the one that handles .com or .al.
- It asks that directory, which points it to the specific servers that know about the exact site.
- Finally it asks those servers, which return the real IP address.
The chain above is the full path for an answer the resolver does not already know. Many lookups are shorter because one of the caches in the chain already has a usable answer. The lookup often finishes quickly, but delay and failure are possible. Only once the resolver hands back an address can the connection to the site begin.
Remembering the answer
Asking that whole chain every single time would be wasteful. You visit some sites again and again, and their address rarely changes. So the resolver keeps a copy of answers it has already found, for a while, close at hand.
Storing information in a temporary place so you can fetch it faster next time is called caching. A DNS answer carries a time to live, or TTL, which says how long a cache may reuse it before asking again. The next request may be answered by a cache in the browser, device or resolver, without repeating the full chain. Caching is one of the quiet reasons the web feels quick.
Tip
Caching is a trade. You get speed by reusing an answer until its TTL expires. If the site's address changes while an older answer is still cached, some people may reach the old address for a while. A site operator chooses TTLs partly to balance lookup work against how quickly a planned change should spread.
Where this model stops
DNS does not turn a name into one permanent number. A name can have several record types and several answers, and the answer can vary by time or location. Caches can also store a negative answer, such as "this name does not exist", for a limited time. DNS finds addressing information; it does not by itself make the destination trustworthy or encrypt the connection.
Check yourself
- DNS is often compared to a phonebook. What does it actually turn into what, and why is that step needed before your packets can travel?
- The lookup can be a chain of questions handled by a resolver. What shortens that chain most of the time?
- Caching makes later lookups faster, but it can delay an address change. How does the TTL set the boundary of that trade?
Where this lesson comes from
You can check these yourself
alphaPlan identifies whether a lesson comes from a taught programme or was authored for this pathway. Where a claim rests on an outside standard or a reported case, it is named above so you can check it rather than take our word for it.
Developed by alphaPlan Center. Who made what
Found something unclear, outdated or improvable? Suggest an improvement