What is DNS? | How DNS works

What is DNS? | How DNS works

Humans access information online through domain names, like google.com or yahoo.com. Web browsers interact through Internet Protocol (IP) addresses. DNS translates domain names to IP addresses so browsers can load Internet resources. Much like a phone book, a domain name system (DNS) bridges the communication gap between humans and computers by resolving domain names to their respective Internet Protocol (IP) addresses.

A DNS or a domain name system is used to translate domain names into IP addresses, allowing the browsers to access other internet resources.

Each device connected to the Internet has a unique IP address which other machines use to find the device. DNS servers eliminate the need for humans to memorize IP addresses such as 192.168.1.1 (in IPv4), or more complex newer alphanumeric IP addresses such as 2400:cb00:2048:1::c629:d7a2 (in IPv6)

How does DNS Work?

When users enter a domain name into the address bar of their web browser, they will be taken to the site they want to visit. However, this instant task consists of several steps known as the DNS lookup or DNS resolution process.

Here’s an example of what the DNS resolution process is typically like to illustrate better how DNS works.

You want to be taken to Binance’s website, so you enter the domain name binance.com into the web browser’s address bar. What you’re doing here is submitting a DNS request.

Next, your computer will check whether it already stored a DNS entry of the domain you submitted locally. A DNS record is an IP address that matches the fully-qualified domain name.

First, your computer will search its hosts file and cache. The hosts file is a plain text file that maps hostnames to IP addresses in an operating system, while the cache is temporary data stored by a hardware or software component.

Matching IP addresses for the DNS service are commonly found in your browser cache or internet service provider (ISP) cache.

However, if no matching IP address is found in your hosts file and cache, other additional steps will be added to the DNS resolution process. If your computer can’t find a matching IP address in your hosts file or cache, it will submit your DNS query or request to a network of four DNS servers. The following section will cover each DNS server and how they work.

What DNS Servers Are Involved in Loading a Website?

There are four servers that work together to deliver an IP address to the client: recursive resolvers, root nameservers, TLD nameservers, and authoritative nameservers.

DNS Resolver

The DNS resolver or recursive resolver acts as the primary intermediary between a computer and other DNS servers. It is designed to receive queries from client machines through applications such as web browsers .Its purpose is to forward a DNS query to other domain name system servers and then send it back once fulfilled.

When the DNS resolver receives a request, it will first search its cache to find a matching IP address for the domain name. If said IP address found, the request sent to the DNS servers ends here, and you will immediately see the site you want to visit.

However, if no match is found in its cache, the DNS resolver will send the request to the next DNS server – the root nameserver.

Root Nameserver

The root nameserver or root DNS server is at the top of the DNS hierarchy. Think of it as a bank of reference.

It doesn’t keep the information you’re looking for, which is the IP address to match the domain name – but it gives directions to where it can be found. It can be thought of like an index in a library that points to different racks of books - typically it serves as a reference to other more specific locations.

Once the root nameserver receives a request from the recursive DNS resolver, it will identify the top-level domain of the domain name. Then, it will tell the recursive resolver to go to the correct TLD nameserver.

TLD Nameserver

The TLD nameserver is a DNS server function that is responsible for storing and managing information about domain names that use a specific top-level domain (TLD). A TLD is the far end of a domain name, such as .com, .org, .online, and .net.

If your query is to find the IP address of hostinger.com, the root nameserver will redirect the DNS recursive resolver to the .com TLD nameserver. Next, the TLD nameserver will inform the resolver about the location of the matching IP address at a specific authoritative nameserver.

Authoritative Nameserver

The authoritative nameserver or authoritative DNS server is the final authority in the DNS resolution process. It stores all information related to the domain name you want to visit, including its IP address. The recursive resolver will obtain the IP address and send it back to your computer, directing you to the site.

Finally, the DNS resolver performs DNS caching, storing IP addresses collected from authoritative nameservers as temporary data. In other words, DNS caching makes it so that the next time you want to visit the same site, it will simply send back the IP address match obtained before.

What Are Domain Nameservers?

A domain nameserver’s job is to store all types of DNS records of a domain name. Whenever someone sends a query about your domain name, the nameserver will send back the necessary information of your domain name, allowing them to find your website.

A nameserver address looks similar to a domain name. Hosting providers usually have two or more nameserver addresses. For example, here are Hostinger’s DNS nameservers:

ns1.dns-parking.com
ns2.dns-parking.com

In practice, nameserver addresses are often used to point a domain name to a hosting account via the DNS services.

If you purchased a domain name from a hosting provider, this action is not needed. However, it must be done if the domain registrar isn’t the same as your hosting provider’s. You can check what your currently set nameservers are using DNS checkup tools or Hostinger’s WHOIS.

For example, if you host a website at Hostinger but purchased a domain from Google Domains, you’ll have to change the domain’s nameservers to point it to Hostinger. Only then will the domain name be connected to the website.