What is DNS?

Let’s face it: DNS can be confusing. It can be confusing to tech professionals, and it can be downright mystifying to ordinary website owners. But it is important to at least understand the basics, especially if you plan on migrating your site from one provider to another or updating any DNS records for any reason. In this first of a series of articles on DNS, I will help you understand what it is and how it works.

IP Addresses and DNS

Computers on a network – and the internet is a giant computer network – need to communicate with one another. They do this by knowing each other’s addresses. This is not unlike how the telephone system works, or even the postal system. If I need to send information to you or request that you send information to me, I first need to know where you are. Your telephone number is your location on the telephone network, and your mailing address is your location in the postal system. Likewise, you’ll need to know my address (either telephone or postal) to send or request information from me.

With computers, it’s an IP address (IP stands for “Internet Protocol”). Most of us have seen these before – a series of numbers such as 72.52.208.12 or 216.58.194.46. Before cell phones, most people remembered perhaps a couple dozen telephone numbers for friends, family, and work, but anything beyond that required a lookup in the phone book. Computer networks can be enormous, too – the number of devices connected to the internet is estimated in the billions — and rather than having to look up addresses in the IP-equivalent of a phone book, a naming system called DNS was devised.

Of course, computer networks can expand and new domain names will be added, or you might want to change the IP that a domain name refers to. In the early 1980s, a massive text file called HOSTS.TXT was maintained by the Stanford Research Institute that kept up-to-date records of names and IP addresses. Early users would need to download this file in order for names to resolve to the correct IPs.

That quickly became unfeasible. If we had to use such a file today, with its billions of entries, its size would be enormous and searching for a given record would be very long and process-intensive. We would also constantly have to be retrieving a new copy. DNS avoids this by decentralizing the “phone book.”

How DNS Works

Here is a basic explanation of how it works. Let’s suppose that your ISP (Internet Service Provider) is Comcast, and you type “webhostingsun.com” into your web browser. The problem is that your computer may not know the IP that webhostingsun.com resolves to, and there is no massive HOSTS.TXT file in which to look it up. What your computer does, in this case, is it asks Comcast’s DNS servers to give you the IP. If Comcast’s DNS servers have cached (or saved) the IP from before, they will send your computer the answer and you are on your merry way. If they haven’t, then they will perform a series of steps:

  1. Send a query to the root name servers. The root name servers don’t know the IP that you want, but they know the name servers for top-level domains (or TLDs), which in this case is .com. There are 13 root name servers in the world, and they act as traffic directors of sorts: if you are looking for the IP of a .com domain name, go this way; if you are looking for the IP of a .net domain, go that way. In our example, the root name servers answer with the name servers that are responsible for .com.
  2. Send a query to the TLD name servers. The TLD name servers also don’t know the IP that you want, but they do know the name servers for individual .com domain names. In our case, the TLD name servers answer with the authoritative name servers for webhostingsun.com, which are ns1.inetsun.net and ns2.inetsun.net.

  3. Send a query to the authoritative name servers. Authoritative name servers store the DNS records for a given domain. In our case, they answer with the A record for webhostingsun.com: 72.52.208.12.
  4. Store the A record in the cache for a certain period of time, so that the next time someone requests the IP of webhostingsun.com, the answer can be given without having to go through steps 1 – 3.
  5. Sends a reply to your computer that the IP for webhostingsun.com is 72.52.208.12.

Now that Comcast’s DNS servers have sent your computer the answer, your computer will then store that IP in its own cache (depending on your settings), and then supply your web browser with the answer so that you can surf to webhostingsun.com!

That is the basics of DNS. In the next article, Understanding DNS Records, I discuss several common DNS records, their usage, and their importance to you.