What is DNS and how does it work?

15 minutes reading


A great domain name is one of the cornerstones of a successful website. If your domain name is relevant, sounds good, and can be easily spelled, your website will experience a surge in traffic, boosting conversions and, ultimately, your revenue. However, your domain name is much more than a brand name. It’s an address. By giving a simple letter combination followed by a TLD, you give your customers directions on where to find your content, products, or services. That’s much like giving a physical address. On the Internet, browsers and machines communicate through numbers. So, while providing the correct domain name is the cornerstone behind receiving more traffic, if the browser can’t translate a domain name into the correct numbers, no matter how imaginative your domain name is, you are not getting any visitors, sales, or profits. That’s where the Domain Name System (DNS) comes into play.

What is DNS?

To understand what DNS is, first, you need to know the basic concept behind IP addresses.

Internet Protocols (IP) are unique numbers that represent each machine that has been connected to the Internet. Essentially, IP is the physical address of each device. So, whenever someone’s looking for your website, the user’s browser searches for the server’s IP address that contains your website’s data.

The Domain Name System (DNS) is an integral part of this process, as it’s the one that translates your domain name into the numbers that lead to the server where all your data is stored. In other words, the DNS is much like a phonebook, with a specific IP address under a specific name. This way, users won’t have to memorize lengthy IP addresses like 192.158.1.38 or, even worse, 2001:cb6:1234:5678:9012:3456:7890:1234. for IPv6.

What is DNS

For example, if you are looking for our website, you will probably type hostarmada.com or https://www.hostarmada.com/ in the address bar of your favorite web browser. To find our website, your browser needs the IP address of the server where our website is stored. So it will send a query to the DNS, which will check its database and find which IP address corresponds to the domain name hostarmada.com. Then, the DNS will relay that information to your browser, so it can send a request to the server to deliver specific data to show on your screen.

In a nutshell, the Domain Name System is the connection between the user’s browser and your website’s server. But if you want to fully understand how your website comes in front of other people, we need to dig a little deeper. For starters, there is more than one DNS server type.

DNS Server Types

What are the DNS server types?

There are four main DNS server types, each playing a separate role in getting your website on the user’s screen.

Recursive Nameserver

This is the first step, where the browser would look for the domain name’s IP address in the Recursive Nameserver. The resolver, however, doesn’t hold any records, so its main idea is to point the browser to the correct Root Nameserver. It operates much like a library catalog, where you can find the place where the book you need is stored.

Root Nameserver

The Root Nameserver is the first that has some logs and can transform your website’s letteral description into machine-friendly numbers. In other words, the Root Nameserver is the first in line with IP address records. This DNS server understands the query and can actually pinpoint the exact location where the server is. It’s much like first-level support. It understands your needs and transfers you to the correct person that can help you with the resolution.

TLD Nameservers

The Top Level Domain servers, as the name suggests, are closely related to your website’s TLD. These are the extensions at the end of your domain name, like .com, .org, .gov, etc. Each TLD stores information in its own TLD Nameservers, so depending on which TLD is used by your website, the user’s browser would be transferred to the correct TLD Nameserver. These servers, on the other hand, will pinpoint the exact server that contains the needed IP address.

Authoritative Nameserver

The Authoritative Nameserver is the one that actually gives the entire information. This is typically the last stop of the query before the browser finds your website. If the user had made a mistake in writing the domain name, this would be the step to find it out. So, if there is a spelling error or the wrong TLD was entered, the domain won’t be found on this nameserver.

For example, if your domain name is domain.com and you type domain.us by mistake, the authoritative nameserver won’t find any logs, or you will receive the wrong server’s IP address if domain.us is registered.

This may sound like a long and tedious process, but in fact, DNS takes only a few milliseconds to complete the eight steps, from writing the query to opening the website.

The 8 steps of opening a website

Getting your website to a user’s computer is an entire adventure if you look at it step by step. Thankfully it only takes a blink of an eye to have all the listed processes done, so you can have the website up and running in just a few seconds.

Step One

Naturally, the whole journey begins with a simple request. The user usually makes this request via their browser’s search bar. The browser will check its own cache, and if there is no log with your website, it will start the process. The first step is to transmit the query to the local DNS server, which is the Recursive nameserver.

Step Two

The recursive nameserver, also known as the resolver, will also check for a cached version of the resolution. If it has one, the browser will receive an immediate answer. If it does not, the recursive nameserver will send a query to the Root Nameserver.

Step Three

The root nameserver will search for which TLD Server is the sought-after IP address. As already mentioned, each TLD has its own nameserver. After it finds the correct TLD nameserver, the root server translates the information to the Recursive server.

Step Four

The Recursive server once again sends the query, this time to the TLD nameserver. That’s why it’s essential to write the correct extension of your domain name, so the Recursive server can communicate with the correct TLD nameserver.

Step Five

During this step, the TLD nameserver checks its records and finds the location of the specific authoritative nameserver with the IP address stored. After that, it sends the information back to the Recursive server.

Step Six

During this step, the Recursive nameserver has finally reached the Authoritative nameserver and requests the A record of the website.

Step Seven

The Authoritative nameserver will find the requested website’s IP address and send it back to the recursive nameserver. During the process, the local DNS server will create a cached record of the website, so it won’t have to go through all the steps each time someone searches for this website.

Step Eight

This is the last step of the search when the Recursive DNS nameserver sends the requested IP address to the browser. After it has the information, the browser will send an HTTP request to the server containing the website’s data. If there are no problems with the logs and records, the browser will receive the requested data and upload it on the user’s screen. Moreover, the browser will save a copy of the record for future use, so if the user wants to get to the same domain name again, the browser won’t have to go through all these steps, but it will directly request the data from the IP.

A diagram illustrating how DNS works

What is DNS Cache?

As you can see, this whole process depends on who has the IP address of the requested website. Therefore, the further down the chain a request must go, the longer the load time.

You may have noticed we often used the term cache. The cache is a locally stored log about a specific website. Once a browser requests a particular IP address, each server down the chain creates a cache to resolve any future requests faster. However, not only the DNS nameservers collect this information for future use. The browser also creates a log with the information on the user’s computer. That’s why you can open a website you’ve already visited much faster (if you haven’t deleted your browser’s cache or you’re not using the Incognito mode). The browser skips all eight steps and directly requests the data from the cached IP address.

Furthermore, each user’s OS has its own DNS cache. This is the last try of the operating system to resolve the query locally without sending any requests through the internet. If it has no record of the website, the browser will send a request to your local Internet Service Provider (ISP), where the Recursive nameserver will start the entire journey. So, if you were wondering, yes, your internet provider has a log of everything you searched on the internet if you don’t use protection.

Types of DNS queries

What are the types of DNS queries?

When we are talking about the DNS servers and how they operate, we must also address the term DNS queries. There are three main types of DNS queries, each having a specific task.

The Recursive query is the request your browser sends to the recursive nameserver or from the recursive nameserver to the authoritative nameserver. These types of queries have only two possible resolutions. The responder can either provide the needed record if it has it stored or, if it doesn’t, to deliver an error. For example, if you send a request for a website that doesn’t exist, the authoritative server will send an error to the recursive nameserver, which will then deliver it to the browser. This will result in a message on your screen stating that there weren’t any DNS records found for this specific website.

The Iterative queries are usually done by the recursive nameserver toward the Root or TLD nameservers. If the request recipients have a cache record, they can send it back to the recursive nameserver, which will transfer it to the browser. If they don’t, however, they won’t send an error, but instead will point to where the record may be found.

Non-recursive queries are done by clients that already have access to the record. Usually, this happens when a server down the chain already has the resolution cached locally or when an authoritative nameserver sends the request. Either way, the query is resolved instantly.

You are probably wondering about these records we’ve mentioned several times now. Well, let’s have a look at them.

What types of DNS records are there?

As you might have guessed, a domain name does not respond to a specific IP address out of the blue. This information needs to be shared with the DNS servers, so they know how to look for the correct IP address. This is where the DNS records come into play.

A DNS record is a piece of text stored in the DNS zone of your domain name on the web hosting server. That alone is quite an extensive topic to cover, but we will keep it simple for this article and will only mention that the DNS zone is stored on the web hosting server. So whenever DNS looks up your domain name it reaches that zone at the end and retrieves the corresponding DNS record which most commonly is the A type of record. There are actually about 50 different DNS record types. However, we will explain only the most important of them.

The A Record

The Address Mapping record, better known as the A record, stores the hostname and the corresponding IPv4 address. This is by far the most important DNS record, as it’s the glue that sticks the domain name to the web hosting server’s IP address. The A record is usually what DNS servers, browsers, and OS store as a cache to provide a faster resolution to the query.

The Quad A Record

You will often see the quad A record as the AAAA record. Its role is the same as the A Record, but it gives the IPv6 address to the DNS.

The CNAME Record

The Canonical Name Record (CNAME) is usually used for redirection. The value of this record can only be another domain name or any hostname. It is typically used when one domain/subdomain should display the content of another.

For example, if you have a domain name, “domain.com,” and you want subdomains such as “www.domain.com” to lead to the same webpage, the CNAME record will provide the DNS lookup with a resolution. This way, if you need to switch your web hosting server or your website’s IP address changes, you will only have to change your primary A record, and all CNAME records that were pointing to your main domain will automatically resolve on the new location.

The MX Record

The Mail Exchanger record will let DNS know which email server is responsible for receiving messages for your domain. Just like you can have more than one email account for your domain, you can have more than one MX record. Still, you will have to prioritize one as primary, as the record is hierarchical. It’s typically a good idea to have at least 2 MX records as if your primary mail server fails to respond, the secondary will.

NS Record

The Nameserver Record shows either the DNS zone of the IP or the authoritative nameserver containing the IP address. This helps the TLD nameserver to pinpoint the correct authoritative nameserver and relay the information to the recursive nameserver.

TXT record

The TXT record is usually used to communicate with other machines. It’s a record that allows text information in the DNS zone of your domain. The TXT record has a variety of applications, but most often, third parties, like Google, use it to verify website ownership.

Configuring these DNS records is by no means an easy task. Even the slightest mistake can render your website useless and unfindable. Needless to say, many issues are generated precisely because of the DNS records. Fortunately, you will get a fully correct and functional DNS zone with each and every web hosting plan that you have with us.

What are the most common DNS issues?

Although DNS is not perfect, the number of DNS-related cases we receive is low. Based on reason, we can separate the most common DNS issues into two types – Internal and External.

Internal DNS Issues

As we mentioned already, with every web hosting plan we offer, we also set up a fully correct and functional DNS zone for your domains internally. If you do not perform DNS changes on the DNS zone, the probability of a DNS issue is 0, except in the single case where there is a connectivity issue with the server. In that case, DNS cannot connect to the DNS zone, resulting in an error.

External DNS Issues

Letting your DNS zone untouched is a certain way to ensure your domain will always be available. However, at a certain point, you might need to perform some changes. There is nothing wrong with that and we provide all the tools you will need to execute the changes correctly. Still, here are some common issues you might face:

  • Messing up the DNS protocols is among the most common problems people face. Therefore, you should always double-check if you entered the correct values in the accurate record. For example, if you fail to enter the proper MX record, you won’t be able to send or receive emails. On the other hand, if you make a mistake while entering the A record, the user’s browser will receive a false IP address, which will send them to a different website, or they will receive an error.
  • Granting access to third parties to your domain’s DNS zone. Allowing someone else to make edits to the DNS zone of your domain is a recipe for disaster. There are countless cases in which we repair broken DNS zones just because proclaimed DNS experts said they could help a customer.

Here at HostArmada, you will always find help with nearly anything web hosting related. Our experts are available 24/7 over the Phone, via Chat, or a Ticket. So whenever you face DNS-related issues, simply get in touch with us, and we will have it all sorted out for you.

Let’s wrap it up

Not everyone feels comfortable swimming in the deep waters of the web-hosting ocean where DNS lurks. Becoming more familiar with it will open new possibilities and might even improve certain aspects of the web hosting service, like, for example, email, accessibility, and website reputation, but more on that in another post.