What is DNS? A Simple Explanation of How Domain Name Systems Work

What is DNS A Simple Explanation of How Domain Name Systems WorkEver imagined how stressful using your smartphone would be if you had to memorize and manually dial any number you wish to call? Thanks to your contact list that associates phone numbers with names, you don’t have to do this. You may not have thought about it, but DNS does the same thing for you every day.

One thing we often forget about computers is that they only understand numbers. Since it will be cumbersome to memorize the IP address of every website you want to access, DNS lets you use human-readable names (domain names) to access a website.

In this guide, we will show you what DNS means in detail as well as a simple explanation of how the domain name system works.

Contents:

What is DNS?

Domain Name System popularly referred to as DNS is one of the bedrocks of the internet that many people use daily, even though most don’t know how it works.

In its simplest form, DNS is an address book that helps the internet to map numbers (IP addresses) and names (domain name) together. It acts as a translator between the user and the computer.

DNS similar to address book

The Domain name system takes a human readable request from your computer’s browser such as fixrunner.com and resolves it to an IP address (74.125.68.102) that the computer can read before displaying the page you requested.

How Domain Name System Works

Although Domain Name System works similar to the contact list on a smartphone, it acts a little bit differently. It uses a distributed system of servers to resolve names and numbers.

The servers where these addresses are stored are referred to as Domain Name Servers or DNS Servers for short. These servers are distributed around the world and communicate with each other regularly to provide timely updates.

There are four primary servers involved in a DNS lookup:

DNS Resolver

A DNS Resolver (also referred to as Recursive DNS Server or Recursive Resolver) is the server that acts as the middleman between the browser and other Domain Name System servers.

It takes the request from the user’s browser and forwards it to the DNS server that has information on where to locate the IP address your browser is requesting.

Root Server

This server is also referred to as Root Nameserver and is the first stop the Resolver makes in a DNS lookup.

There are 13 sets of root servers distributed around the world. The primary function of root servers is to store the addresses for Top Level Domain Servers.

TLD Server

Top Level Domain Server (sometimes referred to as TLD nameserver) stores the address information for top level domain extensions such as .com, .net, .org, etc.

For instance, a .org TLD server will hold information about all the domain names registered with the .org domain extension.

Authoritative DNS Server (Nameserver)

This server (also referred to as the nameserver) stores all the information about a domain name in its database, known as DNS records.

One of the information it stores is the IP address of the domain name which the DNS resolver is requesting. Hence, this is the server that contains information about a particular domain, such as fixrunner.com.

Your hosting company usually provides the nameservers that you will add on your domain registrar’s website to connect your domain to the hosting server.

If your hosting provider is the same as your domain registrar, then the name server is already configured for you by default.

But if you are hosting your site on a different provider, you need to add the name servers from the hosting provider in your domain registrar’s website.

Suppose you are hosting your site with Namecheap, they will provide you with 2 nameservers which you will add in the nameservers settings on your domain registrar’s dashboard. Below is an example of nameservers from namecheap.

dns1.namecheaphosting.com

dns2.namecheaphosting.com

Recursive vs Iterative DNS Query

Let us briefly examine the two kinds of query used in Domain Name System.

In a recursive query, the DNS server contacted by the browser takes the responsibility of finding and returning the IP address or URL requested by your browser.

If the address is not on the server, it will contact other DNS servers to get the address. The server then sends the IP address to the browser once it is found. So it is actively working on the request until the browser gets the information it needs.

However, in an iterative query, the first server contacted will respond with the best information it has about the query. If it has the IP address requested, it will send the information to the browser that is requesting it.

If it does not have the IP address, this server will not directly contact other DNS servers. Instead, it will forward the request to another server that may have the IP address. At this point, the initial server stops working on the query and is free to handle others.

The server with the information will then be responsible for providing the IP address or URL to the browser that made the request.

Performing a DNS Lookup

A Domain Name System lookup is simply the process involved in resolving a domain name into its IP address or vise versa. These are of two types; forward and reverse DNS lookup.

Forward DNS lookup also referred to as normal DNS lookup involves resolving a domain name into its IP address. While reverse lookup does the opposite, it resolves an IP address into its corresponding domain name.

Here, we will focus on the forward lookup simply because that’s the default lookup most websites perform.

Forward Domain Name System Lookup

Suppose you want to visit our website fixrunner.com, the query will be sent from your browser to the DNS resolver. Your ISP (Internet Service Providers) controls this resolver.

Now, the resolver checks its database (cache memory) to determine if it has the IP address for the domain. If the address is not in its database, the resolver will forward the request to the root name server.

The root server stores the IP address for all TLD extension servers. However, it does not know where to find the IP address the resolver is requesting.

Since it knows the IP address of the top level domain server (in our example, the .com domain extension). It will refer the resolver to the .com TLD server.

The .com TLD server contains a database of addresses with the .com domain extension. But it does not know the exact location to look for the IP address for fixrunner.com.

However, the .com TLD server knows the address of the authoritative name server for the domain name (fixrunner.com). Hence, it will refer the resolver to the authoritative server.

Now, the authoritative name server will have the IP address for fixrunner.com since it stores all the information about a particular domain.

How DNS lookup works

At this point, the authoritative server sends the IP address to the DNS resolver so the resolver can send the information to your browser.

Finally, the browser will use the IP address to locate fixrunner.com’s web server and then display the page on your browser.

All the processes involved in performing a DNS lookup run behind the scene without the users’ knowledge. The interesting part is that the entire lookup process typically runs in a fraction of a second.

DNS Cache

When the DNS resolver receives the IP address from the authoritative nameserver, it will store the IP address in its database known as DNS cache for future reference.

DNS Caching helps reduce the processes involved in a domain lookup. For instance, if you type the same web address on your browser, the Resolver will not go through the entire process we explained above. Instead, it will check for the IP address in its cache memory and then send the address to your browser from the cache.

Basic Terms Relating to DNS

Now that we know what DNS means and how it works behind the scene, we will now explore some terms that you may have come across if you have ever hosted a website online.

For example, before you can take your website online, you need to buy a domain name from a domain registrar such as Namecheap or Godaddy. Then connect the domain name to your server using some of the services we will explain below.

The DNS Records

Connecting a website to a domain name requires configuring your server. These configurations are referred to as DNS records because they contain the settings that connect your sites’ IP address to the domain name.

Several DNS record types come with every domain name you purchase from a domain registrar. But in most cases, you will end up using only four of them on your website.

1. A Record: Short for Address Record. This is the address book that contains information about the IP address for a particular domain. IPv4 address (129.0.2.3) is the default format for storing IP addresses on most web hosts.

However, if your server is using IPv6 format, you will need to set an AAAA Record. The address is usually a long string containing numbers and letters, separated using a colon such as 2001:db8:3333:4444:5555:6666:7777:8888.

2. CNAME Record: CNAME is short for Canonical Name. It helps in setting redirects for your domain or subdomain.

Let’s say we have the following records setup in our domain:

NAME TYPE VALUE
up.fixrunner.com CNAME down.fixrunner.com
down.fixrunner.com A 162.0.1.27

When a browser requests the up.fixrunner.com domain name, the server sees a CNAME record and restarts the query using down.fixrunner.com. Since this later subdomain has a record pointing to 162.0.1.27, the ip is returned for the query.

3. MX Record: MX stands for Mail Exchanger Record. As the name implies, this record handles mail forwarding on your server. If you want to use an external mailing system such as Microsoft Outlook or G Suite for your domain, then you will need to configure your MX records accordingly.

4. TXT Record: These are arbitrary Text records that can be used to verify domain ownership when using a service such as Google Search Console. You can also use TXT records to properly set your mailing system to protect against spamming and improve performance as well.

DNS Propagation

If you change your name server to point to another host, or you made changes to the DNS records of your domain, it will take some time for these changes to take effect globally. This process is referred to as DNS propagation.

This process usually takes 1-4 hours to propagate properly. But in some cases, it might take up to 24 hours.

When adding dns records, there is an extra tab where you can specify the TTL (Time to Live) value. This value specifies when the changes will take effect on the server.

For name server configuration, you cannot modify the time it takes for a DNS propagation to update. This is because the time is independent of your hosting provider.

Configuring DNS

Configuring the dns for a new domain name can get complicated especially if you are still a beginner. Here, we will show you how you can set up dns records for a domain.

First, you will want to point the nameservers to where the domain is to be hosted. Suppose you registered your domain with Namecheap, you can find the nameserver settings in the ‘manage’ panel next to your domain name.

Configuring DNS

Here, scroll down and locate the nameserver section, click on the dropdown and select ‘Custom DNS’.

Adding nameservers

Now, add the 2 name servers from your hosting provider.

This will import all the dns records to the hosting server as soon as the dns propagation is completed.

From there you can view all the dns records for your domain name.

Adding and editing records

You can also add a new record such as Address Records, CNAME Records, etc. To add a record, simply click on the Add Record button.

Next, select the dns record type and then input the value you wish to add.

In this example, we used Namecheap as the domain registrar and hosting provider, however, the interface and procedure are similar for most web hosts.

If you cannot find the dns records or name server configuration on your dashboard, you can hire an expert or reach out to your hosting providers for further guidance.

Free DNS vs Premium DNS Compared

Generally, using a premium service comes with some advantages over a free service. The premium version has more security and can protect your site against DDOS (Distributed Denial of Service) attacks.

Although both the free and paid dns resolve ip addresses in milliseconds as we saw in the dns lookup section above. Typically, premium dns performs name resolution much faster than the free version.

Many hosting providers offer free dns by default, which generally has a good performance for an average user. However, if you have the budget, you may want to upgrade to a premium dns as your site begins to grow. This will ensure better performance and improvement in security.

Another option worth noting is Cloudflare’s free DNS. This is arguably the closest you can get to a premium dns performance on a low budget.

Conclusion

The Domain Name System makes it easy for us to access resources on the internet. In this guide, we have explained what DNS is all about and how DNS lookup works behind the scene.

We have also covered the basic DNS configuration steps. Hopefully, you now understand how DNS works and how to set up your nameservers.

If you found this post helpful, please share so others may learn as well.

 This post was written by FixRunner Team

The FixRunner team - an awesome combination of WordPress experts, and technically savvy content creators - are determined to give the WordPress Community a solution to every problem. This diverse team - spanning 3 continents, young and mature, ladies and gentlemen - work seamlessly to keep the wheels running on WordPress sites across the globe.

Last edited by: FixRunner Team