The Domain Name System, or DNS, is one of the most important underpinnings of the internet. It’s responsible for our ability to connect to servers without having to remember long, cumbersome strings of numbers. As a designer or a developer, it’s important to understand what DNS is, how it works, and how to use it.
What is DNS?
In the 1970s, there were so few computers networked together that everyone could easily keep a manual list of every other computer. In the days of ARPANET (a predecessor of the internet), if a new computer was purchased and added to the network, the owner would just tell everyone else on ARPANET, who would just add that new computer to their list. This system worked fine when there were only a few dozen computers linked together but quickly degraded as computing became cheaper and more publicly accessible. In today’s terms, this would be akin to having to notify the entire world any time a new website or service launches.
In the early ’80s, DNS was built to solve this problem by maintaining an authoritative list of domains and which computers they’re pointed at. But how exactly does that work? In technical terms, DNS is a system that is used by nearly every network-enabled device to resolve domain names with associated IP addresses. Think of it as the phone book of the internet.
When you type in a web address such as http://www.getflywheel.com into your web browser, your computer doesn’t automatically just know where to go. It requires an IP address to connect to, but you provided it with a domain name, which is just a string of letters. Domains make it a lot easier for humans to remember where websites are located, but they aren’t what a computer needs in order to make a connection. Instead, your computer contacts a DNS server and asks it for the IP address of that website. The DNS server responds and tells your computer “http://www.getflywheel.com is located at 22.214.171.124.” Your computer grabs that IP address from the DNS server and uses it to connect to the IP address, which in turn brings up Flywheel’s website.
How are DNS records managed and set?
DNS is set via DNS records, which contain such information as what IP address a domain should point to, subdomains, email settings, and even arbitrary text. Once a domain is purchased, the owner specifies authoritative name servers for the domain. These name servers control the DNS records for the domain, which are grabbed by other DNS servers and propagated throughout the entire internet. Generally, if you’re setting your own DNS records, you’ll know the IP address of your website. For example, Flywheel will provide you with an IP address that you can point an A name record to.
There are many thousands of DNS servers across the world, and they all sync up together to maintain a record of where everything is. However, not all DNS servers are created equal.
The structure of DNS servers kind of looks like an upside down tree. There are 13 root or master servers that form the trunk of this tree. They’re the ultimate master copy of DNS. All DNS data must either come from a root server or from a server that has previously contacted a root server and fetched the data. The root servers make up what is called the root zone, or the most authoritative DNS zone.
Past the root zone, there are subzones containing domains. Each top-level domain has its own zone record, which is further divided down into individual domains, such as http://www.getflywheel.com, which are referred to as second-level domains.
This is getting a bit technical, so let’s look at this from the perspective of our tree analogy. With the root zone forming the trunk, each top-level domain, such as .com or .org, is a branch off of that trunk. Each website, such as getflywheel.com is a leaf sticking out of that branch. That one, tiny leaf is the area in which a domain owner has DNS control. Each branch would be an individual name server, keeping track of the branches and leaves that stem from it.
So, when a computer requests getflywheel.com, it first contacts a root server, which says, “You’re looking for a .com website. Go talk to the .com name server, which is located here.” Then, your computer recurses down the chain to the name server responsible for .com and asks it for more details. Your computer contacts servers until it finally finds the name server that is specified by the owner of the domain. Then it figures out the IP address associated with the website and goes to it. Your computer traverses the tree of servers down the branches until it finally reaches the leaf that contains the end target.
Note: Although there are officially 13 root DNS servers, all but two are separately linked and distributed to dozens of identical servers through a routing technology called anycast. Anycast allows several nodes to exist as the same entity. When a device connects to that entity, it will connect to the nearest available node on the network (this is different than geocast, which is used in CDNs, for example, where a device connects to the closest geographic server). Anycast allows the root servers to be multiplied and distributed across the world, balancing load, speeding up response times, and preventing single points of failure.
This whole chain of server contacting seems pretty cumbersome and taxing to have to do every single time you’d like to visit a website. Fortunately, DNS is heavily cached, meaning copies are frequently saved on computers closer to you, taking load off of the root servers and making your queries load faster. Many ISPs, companies, universities, and even your own computer will keep caches of recent DNS queries. If you’re looking for, say, google.com, chances are your computer already has the IP address stored. But if you’re looking for a website you’ve never been to, it’s possible someone else in your neighborhood or company already has been there, and the query and information are just stored your ISP’s DNS server.
Without DNS, we’d each have to remember or write down the IP Address of every single website and computer we’d ever like to visit. Fortunately, DNS is an incredibly resilient, reliable, and impressive piece of engineering, keeping track of all of our websites and our communications so we don’t have to.