• 21 November 2024
What is DNS?

To explore the real answer to what DNS is and how it works, let’s start with a basic example. Computers communicate with each other by using specific numbers or IP addresses. If users want to visit a website, they don’t have to enter a long IP address; instead, they enter the domain name (e.g., arvancloud.ir), and the website will appear on their screens.

Domain Name System (DNS) is a protocol that provides a specific framework for internet browsing. Computers use numbers called IP addresses to connect. Memorizing all these IP addresses is not easy for humans. Well, DNS is a system that connects names to IP addresses.

When users enter a domain name, their computers will find the nearest DNS server and ask for the correct IP address of this name. These requests are called queries. Then, DNS will return the IP address, and the computer can display the requested website.

Generally, DNS is a globally distributed service that helps translate the human-readable names or domain names into the numbers or IP addresses required for computer connections. Some may recall the internet’s domain name system as a phone book controlling the connection between names and numbers.

How Does DNS Work?

To know more about how DNS works, it is necessary to learn about its fundamentals. DNS directory is not located in a single physical location or a small part of the internet. DNS servers are distributed across the world and stored on millions of servers that are communicating with one another regularly to provide redundancies, data, and updates. DNS information will be shared among various servers. It will also be cached on individual computers or devices locally. It will prevent users’ computers from querying the name server for already used IP addresses each time, which will result in speed and efficiency.

In loading a requested page, there are four DNS servers involved:

DNS Recursor

This server is tasked to handle the queries directly from the user’s machine through a web browser and similar applications. DNS recursor server responds to DNS query and asks other DNS servers for the requested addresses. It may already have the IP addresses for the saved sites as well.

Root NameServer

The root name server translates the human-readable hostnames/web URLs into IP addresses. This is a server for the root zone, responds to requests, and returns a list of authoritative name servers for the related top-level domain.

TLD NameServer

The Top-Level Domain (TLD) name server is a high-level DNS server. It is responsible for categorizing websites according to their types. TLDs can include .com, .org, .net, etc.; if users search arvancloud.ir, the TLD for .com will respond first, and then DNS will search for ArvanCloud.

Authoritative NameServer

The authoritative name server is the final step for a DNS query. It has the DNS records for that request. If this server has access to the requested question, the IP addresses will be given to the DNS recursor, making the original request.

It is very important to know how DNS works because it is an integral part of the internet. If you think of DNS as a phone book, it is tasked to map people’s names to their street addresses. DNS maps computer names to IP addresses. Each of these mappings is considered a DNS record.

DNS is divided into smaller books called domains. Domains can be organized into smaller books called zones. This way, a single DNS server won’t be responsible for storing all the data. Instead, many DNS servers keep all the DNS records for the internet.

If a computer wants the data of a number or name, it will ask the DNS server. That DNS server will ask for the query from other DNS servers once a record is needed. When a DNS server queries other DNS servers, it is an upstream query.

A domain’s queries are upstream until related to the domain’s authority or authoritative name server. Where administrators manage server names and IP addresses for the domains is called an authoritative server. If a DNS administrator wants to change, delete, or add a server name and IP address, the authoritative DNS server should be changed. Sometimes it is referred to as a master DNS server. There are also slave DNS servers that keep copies of the DNS records for their zones and domains.

How Does DNS Work

Different Types of DNS Servers

Another essential step in understanding how does DNS work is to know about different types of DNS servers. There are two different types of DNS servers on the internet which manage DNS queries based explicitly on their functions.

Read also: 3 Types of DNS Servers You Should Know about

Recursive DNS Resolver

A recursive DNS resolver is a server that responds to DNS queries, looks for authoritative name servers or cached DNS results for the requested name. Put simply; it will track down the records needed to respond to a user.

Authoritative DNS Server

An authoritative DNS server will store the DNS requests. It keeps DNS resource records. This way, an authoritative DNS server does not need to look anywhere if a user asks it for one of the IP addresses. It is the final authority on names and IP addresses, and it will use its data to respond to queries.

Essential Steps in a DNS Lookup

This simple example will explain how DNS works in specific details. When a user types a website name in the browser address bar, a DNS request starts. This DNS request will be directed to the local DNS cache. Since the IP addresses will be stored in a local repository, the IP addresses will be in the DNS cache if they visit that website before. If the IP address is not cached, DNS will ask for a recursive DNS server. This recursive server is provided by the ISP or IT team.

Since the recursive DNS server has its cache, it will return the IP addresses quickly. If not, it will question another DNS server. The request will be sent to the specific TLD name server. This server will send the DNS requests in the right direction.

TLD name servers have the authoritative name server’s location for the requested website. The authoritative name server then responds with the IP addresses for the requested website. The recursive server stores it in the DNS cache and returns the address to the user’s computer.

Lately, the local DNS service receives the IP address, connects to the website addresses, and downloads it. DNS records the IP addresses on the local cache with a Time-To-Live (TTL) value. TTL refers to the amount of time the local DNS record is valid. After it, DNS will go through the process again once the user requests the same website next time.

Types of DNS Queries

DNS queries are the computer codes that explain DNS servers what kind of queries it is and what information it needs. A standard DNS lookup includes three DNS queries.

Recursive Query

The computer asks for an IP address or mentions that the DNS server does not know its address in a recursive query.

Iterative Query

In an iterative query, the requester asks a DNS server if it has the answer or not. If the DNS server does not have the IP addresses, it will return the authoritative name server to the TLD name server. This iterative process will be continued until the answer is found or times out.

Non-Recursive Query

A DNS resolver uses a non-recursive query to find an IP address that is not cached. These queries are limited to a single request to limit network bandwidth usage.

DNS caching

The repository of domain names and IP addresses stored on a computer is DNS cache. In case of a request, the information won’t be sled every time. If a user wants to go to a website, and each time DNS has to query the authoritative name server at that website, the traffic will be overwhelmed. The most significant purposes of DNS caching are:

  • Speeding up the DNS requests
  • Reducing bandwidth usage of DNS requests

Here are a few types of DNS caching:

Operating System (OS)

All the operating systems have DNS resolvers referred to as stub resolvers. This is the second place for a DNS query to be resolved before it leaves the local device. Once a request is made, the OS resolver looks for it in its cache; if it does not have the answer, the DNS query will be sent to the DNS resolver on the local network managed by ISP.

Browser DNS Caching

Many modern web browsers are designed to cache DNS records. This will make it possible for the IP addresses availability once their request is made. The browser cache is the first location checked for a requested record.

Recursive Resolving DNS Caching

Each DNS recursor has a DNS cache and stores IP addresses for the next request. It checks its local cache to see if it has the IP address for the requested host.

Final Thoughts

DNS has been used for a long time, and literally, every computer connected to the internet relies on it. In this article, we discussed what DNS is and explained how DNS works in detail.

If you want a cost-effective service with the highest availability, security, and flexibility, ArvanCloud Managed DNS hosting is the one. This world-known authoritative DNS service offers advanced protection and quick response time. If you have any questions, contact us.