You remember your friends by name, not by their phone numbers. Your phone’s contact list does the translation: tap “Amma”, and it dials the right number.
Computers on the internet find each other by numbers called IP addresses, like 203.0.113.10. But people remember names like kagitha.com. Something has to translate the name into the number every time you open a website, send an email or call an API. That something is DNS.
This guide explains what DNS is, what happens during a lookup, and why system designers care about it.
What is DNS?
DNS stands for Domain Name System. It is a huge, shared directory, spread across many servers around the world, that answers one main question: “What is the IP address for this name?”
Nobody owns one master copy. Instead, the job is split up:
- Root servers know where to find the servers for each ending, like
.com,.orgor.in. - TLD servers (top-level domain) know, for example, which servers are in charge of every
.comname. - Authoritative name servers hold the real answers for a specific domain. If you own
kagitha.com, you (or your hosting company) set its answers here. - Resolvers do the legwork for you. Your internet provider, your office network, or public services like Google’s
8.8.8.8and Cloudflare’s1.1.1.1run them.
What happens when you type a website name
Say you type kagitha.com into your browser and nothing is cached yet. Here’s the journey, simplified:
- Your computer asks its resolver: “What’s the address of kagitha.com?”
- The resolver asks a root server, which replies: “I don’t know, but here are the
.comservers.” - The resolver asks a .com TLD server, which replies: “Ask kagitha.com’s name servers, here they are.”
- The resolver asks the authoritative name server, which replies with the actual IP address.
- The resolver gives the answer back to your computer and remembers it for a while.
- Your browser connects to that IP address and loads the page.
That sounds slow, but in practice most of these steps are skipped. Resolvers cache the .com servers for a long time, and popular names are already cached because someone else asked recently. Your browser and operating system keep their own small caches too. So most lookups finish in a few milliseconds, or don’t need the network at all.
DNS records: the different kinds of answers
A domain’s authoritative server holds records. The ones you’ll meet most:
| Record | What it says | Example |
|---|---|---|
| A | The IPv4 address for a name | kagitha.com → 203.0.113.10 |
| AAAA | The IPv6 address for a name | kagitha.com → 2001:db8::10 |
| CNAME | “This name is another name” (an alias) | www.kagitha.com → kagitha.com |
| MX | Which servers receive email for the domain | mail.example.com |
| TXT | Free text, often used to prove you own the domain | google-site-verification=… |
| NS | Which name servers are in charge of the domain | ns1.example-dns.com |
TTL: how long answers are remembered
Every record comes with a TTL (time to live), in seconds. It tells resolvers how long they may reuse the answer before asking again. A TTL of 3600 means “remember this for an hour”.
This is a real trade-off:
- Long TTL (hours or a day): fewer lookups, faster for users, less load on your DNS. But if you change the IP, some users keep going to the old one until their cached copy expires.
- Short TTL (a minute or so): changes spread quickly, which helps when you need to move traffic in a hurry. But more lookups happen.
How system designers use DNS
DNS isn’t only a phone book. Because it decides where users go first, large systems use it to steer traffic:
- Pointing to a load balancer. A name usually points to a load balancer, not one server, so servers can come and go behind it.
- Sending users to the nearest region. “GeoDNS” or latency-based routing gives users in India the address of a Mumbai data centre and users in Germany a Frankfurt one.
- Failover. If a health check says a region is down, DNS can stop handing out its address and send everyone to a healthy region. See failover.
- CDNs. When you put a CDN in front of your site, DNS is what sends each user to a nearby edge server.
The catch is caching. DNS changes are never instant for everyone, because resolvers and devices hold old answers until the TTL runs out (and a few ignore TTLs). That’s why DNS-based failover is usually measured in minutes, not milliseconds.
Common misconceptions
“DNS is only used when I open a website.” Almost every network call uses it: apps talking to APIs, services talking to databases inside a data centre, email, and more.
“A DNS change takes 48 hours to spread.” This old rule of thumb mostly came from long TTLs. With short TTLs, most users pick up a change within minutes. The real delay depends on the TTL you set.
“DNS is a single server somewhere.” It is one of the most spread-out systems on the internet, with many copies of every layer. That spread is why it rarely goes down as a whole, though a single DNS provider having an outage can take many sites offline at once.
Key takeaways
- DNS turns names like
kagitha.cominto IP addresses that computers use. - A lookup goes resolver → root → TLD → authoritative server, but caching skips most steps.
- Records hold the answers: A, AAAA, CNAME, MX, TXT and NS are the common ones.
- TTL sets how long answers are cached: long is fast, short is flexible.
- Big systems use DNS to send users to load balancers, nearby regions, healthy regions and CDNs.
Frequently asked questions
What is DNS in simple words?
DNS is the internet’s phone book. You type a name like a website address, and DNS looks up the number (IP address) that computers need to connect to it.
What is a DNS resolver?
A resolver is the server that does the lookup for you. It asks the root, TLD and authoritative servers in turn, then caches the answer. Your internet provider usually runs one, and public ones like 1.1.1.1 and 8.8.8.8 exist too.
What is the difference between an A record and a CNAME?
An A record points a name directly to an IPv4 address. A CNAME points a name to another name, which is then looked up in turn. CNAMEs are handy when a provider gives you a name to point at, like a CDN or hosting service.
Why does a DNS change take time to show up?
Resolvers and devices cache answers until the record’s TTL runs out. Until then, they keep using the old answer. Lowering the TTL before a change makes it spread faster.
Is DNS a single point of failure?
DNS itself is very spread out, but your domain depends on the DNS provider you choose. If that provider has an outage, people can’t look up your name. Some large companies use two DNS providers for that reason.
Comments