The Domain Name System (or DNS) converts human readable domain names (like: www.google.com) into Internet Protocol (IP) addresses (like: 184.108.40.206).
Computers can only communicate using series of numbers, so DNS was developed as a sort of “phone book” that translates the domain you enter in your browser into a computer readable IP.
A Brief History of the DNS
Thirty years ago, when the Internet was still in its infancy when you wanted to visit a website you had to know the IP address of that site. That’s because computers are and were only able to communicate using numbers.
This is an IP address: 127.33.54.200.
It’s long, hard to remember, and we (humans, I presume) are not robots. We needed a way to translate computer-readable information into human-readable. And it had to be fast, lightweight, and scalable.
In the early 1980’s, Paul Mockapetris came up with a system that automatically mapped IP addresses to domain names.. and the DNS was born. This same system still serves as the backbone of the modern Internet, today.
And yet, only a small subset of the world knows that it exists, and an even smaller group understand what it does. The real problem is that the people that need to know how it works and could actually benefit from this knowledge… don’t take the time to learn.
How Does It Work
Before we get into how you can use the DNS, we need to understand how the system works. We already know that it maps IP addresses to domain names, but where is this information stored? On nameservers!
Nameservers store DNS records which are the actual file that says “this domain” maps to “this IP address”. So is there a room somewhere that has all the nameservers and DNS records for every site on the Internet? No… that would be ridiculous.
They are actually distributed all around the world. These nameservers are called the root nameservers and instead of storing every domain ever, they store the locations of the TLD (top level domains).
TLD’s are the two or three character like .com that end a domain name. Each TLD has their own set of nameservers that store the information that says who is authoritative for storing the DNS records for that domain.
The authoritative nameserver is typically the DNS provider or the DNS registrar (like GoDaddy that offers both DNS registration and hosting). And here we can find the DNS record that maps example.com to the IP address 127.66.122.88.
The Big Picture
Let’s put that all together. When you query a domain name your first step won’t actually be at the root name servers. Instead, your browser will ask your local resolving name server if they have the DNS records for that domain cached.
The resolving name server is typically your ISP (Internet Service Provider), and if it’s a popular website like youtube.com they will likely have the record in their cache. In this case, you would skip the rest of the DNS lookup process.
However, these records are only stored for a short period of time. Whenever you create a record, you have the option to set a TTL (Time to Live). TTL’s tell resolving name servers how long they can store the record information. TTL’s can range anywhere from 30 seconds to a week.
What if the record we are looking for isn’t cached? Then the resolving name server will ask the root name servers for the TLD for that domain, which will point you to the provider authoritative for hosting the records.
Okay, that was a lot of steps to go through just to find the IP address. Oh, and by the way, this process happens in just a couple milliseconds. A little perspective, you blink your eye in roughly 50 milliseconds. You can resolve most DNS queries in under 30.
See It in Action