DNS Fundamendals: How Domain Names are Mapped to Websites
DNS, which stands for "Domain Name System", is the magic that lets you type "newmediacampaigns.com" and be taken to this website. It's really quite wonderful. Without it, domain names wouldn't work, and you would be left "dialing" numbers to get places on the internet.
If you've heard the words, "Uhm, I'm still seeing the old website." after a new website launch, you know DNS isn't all rainbows and unicorns. This article will hopefully clear up some of the confusion behind what DNS is and how it functions.
Before we pull back the curtain on DNS, let's take a step back and make a few things concrete. There are three fundamental concepts behind DNS:
- DNS is like a 411 (domain-)name-to-number lookup service for computers calling each other
- Computers redial numbers they have found in DNS
- Computers forget numbers they have found in DNS after a period of time (TTL)
You've seen a desktop tower computer before, right? Imagine one that looks just like the graphic to the left. Picture this computer, connected to the internet on the fifth floor of a building in Dallas, sitting alongside hundreds of thousands of other computers just like it. This is our server. It's simply a computer. It's not just any computer, though, it is the exact computer yours just "called" in order to load this article. When you clicked on a link to this blog post, your computer very literally "talked" with our computer in Dallas.
This sounds simple, but is important:
When your computer needs to load a website, there is literally another computer, physically located somewhere in the world, it needs to talk to.
When you need to talk to someone in Dallas, what do you do? Dial their number. If you don't have their number? You call 411 to look it up, first.
Computers Calling Computers
In the process of loading this article, your computer did the same thing. DNS is 411 for computers. It called DNS and asked "what's newmediacampaigns.com's number"? DNS told your computer our number, 18.104.22.168, and then your computer called ours up directly, down in Dallas.
Your computer uses DNS to look-up other computers' numbers by (domain) name. That's all there is to DNS, minus one gotcha: caching.
When your computer loaded this article, it dialed our computer up a number of times, in rapid fire. Every call it asked our computer for something different:
- What is the content on the page?
- What images are there?
- What should the font be?
Imagine you needed to quickly call-ask-answer-hang-up, call-ask-answer-hang-up, call-ask-answer-hang-up, with the same person in Dallas. Would you dial 411 to lookup their number every time? No, you'd hit redial from your phone's call history.
Your computer does the same thing with DNS lookups, and this is called caching. Your computer called DNS once to get our computer's number, and then called our computer a bunch directly, by redialing the number in your computer's cache. What happens when a computer's number changes? (Like, for example, when your new website launches.)
Caching, a.k.a. Redialing
If our computer's number changes, yours would eventually get the new number by forgetting the old one and asking DNS to look us up again. Until it forgets our old number, though, your computer will still call it and either show you the old website or an error. This is the gotcha, and it's where DNS problems and confusion arise.
Luckily, when DNS tells your computer our computer's number, it also tells your computer how long to remember it for. You can control this duration for your domains. It's called the "time-to-live" or TTL record. With TTL, you can control the longest amount of time a client's computer could still dial their old server's number after you've updated DNS to take a new site live.
To recap, these are the fundamental concepts behind DNS:
- DNS is a 411 (domain-)name-to-number lookup service for computers calling each other
- Computers redial numbers they found in DNS
- Computers forget numbers they found in DNS after a period of time (TTL)
In the second part of this series, we'll take these fundamentals and apply them to a few common scenarios while using common tools to help diagnose problems.
Leave the first comment