DNS Working Explained

How does the Domain Name System (DNS) Work?


     How does the Internet actually work? 

    That is a question that is asked by a lot of people while they are surfing the web, video calling someone over the web or streaming something live. This post explains what a DNS is and how it works based on what I understood from my reading. I hope it is helpful to others who are trying to answer this question.

    The Internet as we know it relies heavily on something called a DNS (Domain Name System ): a database of network names and IP addresses. Without DNS, the Internet that we use in our day to day lives would simply not exist and all that would be left is us staring at screens that show only binary. This also means that all the tasks we depend on the internet for such as shopping, web browsing, research, communicating or downloading would not be possible because we would not be able to make sense of anything we see. This is why experts have an apt name for DNS. They call it 'The Phone Book of the Internet'.

     The Question now is 'What is DNS?'. Simply, DNS is an expansive and comprehensive transaltion system to search through the internet. Anything connected to the Internet - laptops, tablets, mobile phones, websites - has an Internet Protocol (IP) address made up of numbers. What this system translates is the web itself by assigning user friendly domain names to unique IP addresses. It provides a way to match names (a website you’re seeking) to numbers (the address for the website).It translates a gargauntuan amount of data into comprehensible phrases or words to provide accurate results. For example, the Google search page has an IP address of 216.58.193.68. When you enter the web address as https://www.google.com the DNS takes that input and maps it to the IP address given above. It then displays the google search page.


In its simplest form, the DNS is a database that maintains the names of websites, such as google.com, and links them to particular IP addresses that consist of a number pattern (i.e. 216.58.193.68). However, this can be understood as its simplest task. Linking addresses to names is the basic function of DNS, as is it used for a variety of services, apart from host-to-address mapping.


There are some more function that DNS is responsible for including locating IP addresses to specific site names and then storing that data. This process of storing the IP addresses is called 'Record Maintainance'. The second function is the distribution of the DNS over a distributed network as it can store a large set of records. In most circumstances, the DNS is a term used to define a database that can be shared easily. This sharing is needed because only a small portion of the website name to IP address mappings are stored on each server at any given time. DNS servers are configured with a special record that informs where the DNS server is located. Due to this process, each DNS server holds a small part of the host to IP mapping address. This collection of host to IP address mapping is also called the 'Namespace'. The user must first check the high-level database when looking for a website, which tells the client how to check the DNS server host. As a next step in the process, it specifies queries the client can address through the hostname given by the DNS server. The process continues until the user finds the correct server that hosts the DNS required.


When you type a web address, say https://www.google.com, into your browser, it sends a query over the internet to find the website for the address you entered. A query is a question seeking to match the domain name to its corresponding IP address. The First server that the query passes through is the 'Recursive Resolver'. This server is usually operated by your ISP or a third party provider. This server knows which other servers it needs to contact to get the answer to the original query question 


'What is the IP address for https://www.google.com'


The first type of DNS server the recursive resolver talks to is called a Root Server. These Servers are running all over the world and each knows the DNS information about top level domains that use .com. To respond to the User's query, the response resolver asks a Root server for DNS information on the .com site. There are Root servers present in more than 300 locations around the world.

There are thousands of servers that support each of these Root servers. They are usually located strategically according to where the highest levels of internet activity takes place. The DNS Root server makes sure that the user's query is assigned to the server that is closest to it. 

Each Top Level Domain(TLD) DNS name server stores the address maps for lower level domains within the top level domain (like .com, .net, .tv etc.). When the query reaches the TLD server, it answers with the IP address of the domain's name server where the final steps occur.

The recursive resolver send the query to the domain's name server. This DNS server contains all needed information on the domain. It stores the IP in both IPv4 and IPv6 forms and returns this information to the recursive resolver which then brings the information to the user's browser to let it know where to send requests to retrieve content from the website.

This whole process of query and response happens in a matter of milli seconds and therefore is near instantaneous. This is what enables us to visit a webpage whenever we want to.