How a DNS Server Works? (Domain Name System)

Photo of author

By Sina Nasiri

There is one secret that your computer doesn’t want you to know; it doesn’t understand your language. Computers have their language, which they use to communicate with the hardware and with other computers. Like humans, even computers communicate with each other, and their communication takes place over the Internet.

But how do 2 computers find each other for communication? Well, just like humans have their home addresses where they live, computers, too, have their address, and when one computer sends the request to get connected with the other, it sends the request to the address of the other computer. We humans can’t understand and remember the address of multiple computers.

Let’s take an example. You see this article on your computer, which is present online on our website. This website of ours is also stored in some computer, which is known as a server. How does your computer connect to our server and send the information back to you?

Also, we said humans couldn’t understand the language of computer communication then how did you reach this page? Well, in this whole process of requesting, receiving, and sending the information, DNS plays a vital role, and we are going to tell you how it works. In this article, you will be learning about the importance of DNS servers and their usage and benefits.

What is DNS?

Every computer, laptop, smart tv, and even your phones serve you content from websites that are present on the Internet. This serving of content is done by computers communicating with one another by using a specific sequence of numbers.

These serial numbers are known as IP addresses. When you open a browser to serve the Internet, you don’t have to remember the serial number or the IP address of the website. Instead, you type in the domain name (or the URL), and the browser opens up the website for you.

A DNS service is the one which you need to thank here, as it translates the likes of the human-readable names, Facebook.com, nytimes.com, Instagram.com into numeric IP addresses such as 192.0.2.2, which is used by computers to make a connection with each other to transfer and receive the information requested by you.

In other words, a DNS server is your Internet’s phonebook as it manages the mapping of domain names with their IP addresses. On the other hand, DNS servers also translate the requests for names sent by the browsers in IP addresses.

These requests which are sent by your browser to the DNS server are known as queries. There are multiple types of DNS servers, and as a network administrator, one needs to know about all of them and their working.

History of DNS

When the Internet was still a tiny place, and it was pretty new, it was more accessible for people to directly type in the IP address and reach the web page directly. But as we know, that didn’t last for too long as with each new individual joining the Internet, it became tough to remember the IP addresses of different computers and websites.

Even right now, if you can find the IP address, you can type it on your browser’s search bar, and it will direct you to the website. No redirect will be used, and you will be taken straight to the website’s homepage.

The first DNS server was not a computer. This statement might shock you, but it is the truth. The first form of DNS server was appointed in the 1970s, and she was working till the early 1980s. Elizabeth Feinler maintained the names and addresses at Stanford. She kept a master sheet of every Internet-connected computer in a text file, and she named it HOSTS.TXT.

Well, her job was becoming problematic as each day passed, and it indeed became an untenable situation for her when the Internet exploded to the mainstream. Then in 1983, Paul Mockapetris was given a task to find a way to automate the work which Elizabeth was doing.

After much research and ignoring multiple suggestions from his colleague, Paul came up with his system, which he named DNS. The truth is since its inception, DNS has changed a lot, but it still works on the same principle that Paul made almost 40 years ago.

Why Do We Need a DNS Server?

As a human, it is easier for us to remember friends, places and family members because we know the language from which names have originated. We all have smartphones, but back in 2000, we could only save around 20 phone numbers on our mobile phones due to space restrictions.

Back in those days, we used to have a diary where all the phone numbers were written. But now, all the numbers can be saved in your phone’s contact list. So think of DNS as your contact list, which saves your friends’ phone numbers (IP addresses). So when you need to get in touch with one of your friends, you type their name (domain name), and the call connects (website gets displayed). Remember:

  • The domain is the name that you have in your contact list.
  • The IP addresses are the respective phone numbers to names.

DNS also has a credit in displaying the website on a browser. Every website or domain has its IP address, even a domain whose website hasn’t been made yet. It still holds an IP address.

You need to understand one thing, first came the IP address, and for the ease of humans to operate the Internet came the domain name. And to connect the IP address with its domain name, we have DNS servers.

How Does DNS Work?

  • Step 1: You type in the human-readable address of a website. The OS of your computer will send the information to your DNS client.
  • Step 2: The DNS will check for the information in the local cache.
  • Step 3: If the requested address is not present in the local cache, the DNS will look for the same in the Local Area Network (LAN).
  • Step 4: If DNS found the address in LAN, it will send in the required information back to your computer, and the website will be opened.

If this does not happen, the query will be forwarded to the DNS cache server provided by the Internet Service Provider (ISP). The DNS server’s cache contains a temporary store of DNS records. So it will be quite fast in responding to your query request.

These servers are known as not authoritative DNS servers, which we will discuss in the coming sections. That’s how you get to open your favorite website. No matter if it’s YouTube.com or Facebook.com, it follows the same query procedure.

DNS Caching

Now that you know about how DNS works, you might be wondering what DNS caching is. Well, DNS caching works like any other caching. It is a temporary storage of information about the previous DNS lookup on your computer’s OS.

The DNS caching allows the copy of the previous lookup to be saved to quickly respond to repeated queries. This caching of the DNS lookup makes the loading of a website more efficient. The primary function of different types of cache is quite identical.

Also, DNS caching takes place on 2 levels. The first one is the DNS caching that is done by your operating system. The second level of DNS caching is done by your browser.

There are multiple steps of DNS lookup as it first passes through a resolver, then to a root server, and after that, it reaches the TLD server. At each of these steps, the information is collected and cached so it can be used again when needed.

As a result, even if your local DNS looks empty, the resolver might have the necessary copy of the DNS lookup information. Thus, the whole process of retrieving the data can be avoided with the use of different layers of DNS caching.

What is DNS Lookup and How to Perform It

There are two types of DNS lookup: forward lookup and reverse lookup. The forward one is also said to be the simple DNS lookup as it’s the one that is most commonly used.

Forward DNS Lookup

If we have to sum up the forward DNS lookup, it can be done in one line, “the forward DNS will simply find out the IP address of a domain.” As it is difficult for humans to remember the long strings of numbers, it is a lot easier to remember the domain name formed by using English.

Apart from this, computers communicate using binary code language, which is made from 1s and 0s. The method of communication requires a specific identification number which is known as the Internet Protocol (IP) address. Below are the steps used by your computer to locate a web page known as DNS resolution in technical terms:

  • First, you enter the domain name in your browser.
  • Then your computer transfers the domain name as a DNS request to your Internet Service Provider (ISP).
  • After that, the ISP checks if they have the required information for the requested domain. If the ISP finds the information, it will send that to your browser, and the website will open.
  • On the other hand, if the ISP is unable to find the information, it forwards your request to other providers to locate the DNS record with the information.
  • Once the record has been found by one of the other ISPs, the domain’s IP address will be returned to your computer.
  • In the last step, the connection has been established between your computer and the server, which has the information directly.
  • Hence, you receive the information about the website on your computer, and the browser will display it.

You might think this is a long process, and it must take some time for you to get back the information that you needed. But look at your browser. Does it take too long to load a website? No.

The web page gets displayed to you in mere seconds because of how the information is sent via a global network, which is another interesting topic. Still, we will explore that topic in some other blog.

Reverse DNS Lookup

You might have seen the error message “This webpage cannot be found,” when you are browsing the Internet, well, that’s because servers are too busy and can’t complete your request or the web browser has timed out.

Both of these situations occur when the reverse DNS lookup takes place. In a reverse DNS lookup, everything is the same except the search for the information starts from an IP address, and it returns with a domain name. When this happens, you can be sure to see your browser waiting to load up the information as the reverse DNS lookup takes time.

Different Types of DNS

There are 3 types of DNS servers that are being used to find out the IP address of the domain name that the user enters. Given below, we have explained the trio in detail:

 

1. DNS Resolver

The first one from the list is the DNS resolver server, which is also a recursive server, meaning it has to give back an answer to the query which is sent to it. It is a server that receives DNS queries that contain human-readable hostnames like “www.facebook.com.”

This particular DNS server is responsible for tracking down the IP address of the domain name that you have entered in your browser’s search bar.

 

2. Recursive DNS Resolver

The first stop of the DNS query is the recursive resolver which is also known as a DNS recursor. This DNS works as a middleman between the client and a DNS nameserver. When the recursive resolver receives a DNS query from a web client, it will respond with either cached data or send a request to a root nameserver. This process is followed by another request forwarded to the TLD nameserver, and then one more request is sent to the authoritative server at the very end of the process.

 

3. Authoritative DNS

This is the second type of DNS server, if we have to explain the working of authoritative DNS by taking the example of a phone book. Then authoritative DNS will be the copy of the phone book, which has the information of matched IP addresses with domain names.

These servers are responsible for providing the information when it comes to recursive DNS nameservers about where the IP address of the specific website can be found. Just like phonebooks, authoritative DNS are also differentiated on the basics of their regions such as the company, its local area, country, etc.

On the other hand, no matter from which region an authoritative DNS server belongs, it has to perform 2 critical tasks. First, it has to store lists of domain names along with IP addresses that are associated with the domain names. Second, it has to respond to requests from a recursive DNS server and send the information that includes the correct IP address of the requested domain name.

Conclusion

The DNS server is one of the crucial parts of the Internet. We can even say that without the DNS servers, the Internet will not work. So it’s safe to say that DNS servers are the foundation of the modern-age internet.

If the recursive DNS service of your computer gets interrupted for some reason, you won’t be able to browse the Internet. Unless you have a photographic memory and you can remember the IP address of the website.

Now, some companies are actually providing DNS service to their customers. These DNS services not only come up with 100% uptime, but the loading speeds are exceptional. The added layer of security is a plus so that a user can surf the Internet without having to worry about their data at the risk of being stolen by hackers.

People are also reading: 

Leave a Comment