Phonebook of the Internet: DNS in Simple Words!
We all have been using the internet for years, maybe decades, and we all know that the internet is made up of many computers. But have you ever wondered how binary-oriented computers bring you your favorite websites within milliseconds by typing a name? This article will answer all of your problems related to internet name resolution.
If you are already familiar with some knowledge about internet such as URLs and IP addresses, you can directly proceed to the “What is DNS?” chapter below.
Background
As you already know, computers in any network identify themselves via unique IDs. Internet Protocol (IP) Address and Machine Access Code (MAC) Address are their primary IDs. Using these IDs, they can communicate with other computers. The IP address is a logical address assigned to a computer like a software configuration. But the MAC address is a physical address assigned to a computer when it is manufactured. So the computer cannot change its MAC address without changing the network interface card.
However, when there are multiple interconnected networks, there will be a requirement to route the data among these interconnected networks. Therefore, computers should be able to identify a computer in another remote-connected network and its network. IP addresses are used as the unique identifier in the above case to identify remotely connected computers uniquely.
According to the relevant IP version, IP addresses are either in decimal or hexadecimal numbers. An IPv4 address looks like 185.199.111.153, while an IPv6 address looks like 2606:50c0:8002::153. But we rarely deal with these numbers in our day-to-day life. Sometimes, you may haven’t noticed these numbers when using the internet. Instead of these so-called numbered IDs, we use IDs more likely a word, phrase or sentence when using the internet. Using such alphabetical IDs over numerical IDs has made it easier for people to read, write, type, and memorize these IDs. This facility is provided by an internet service called Domain Name Service (DNS).
Before going deep into DNS, let us focus on domain names. Domain name is a part of a URL as shown in the following diagram. In DNS resolution, DNS resolver considers the subdomain, domain name and top-level domain to deliver the respective IP address.
What is DNS?
DNS is a system of hierarchical and decentralized servers serving DNS requests from DNS clients. It maps the alphanumeric (Not just alphanumeric, but also most of the Unicode characters) IDs known as Domain Names to the relevant numerical IDs known as IP addresses. This system consists of multiple components.
- Resolver
- Root Nameserver
- Top-Level-Domain Nameserver
- Authoritative Nameserver
These four components work together as a complete domain name system.
Step 1: The DNS service is used by the client applications such as web browsers and other internet-based software applications. These client applications send a DNS query to the resolver asking for the IP address for the specified domain name.
Resolver is the closest component to the end-user. It may reside on the same device as the client application or on a separate server. It also acts as a DNS cache accordingly. If this is a separately hosted server, it can act as a Recursive DNS server that fulfills the receiving queries by recursively following the results from higher DNS servers such as Root and TLD.
Step 2: Root Nameservers are at the top of the DNS server hierarchy, which points out the IP addresses of TLD nameservers responsible for the requesting domain name.
Step 3: Top-Level-Domain (TLD) nameservers are the 2nd level DNS servers in the hierarchy. Resolvers reach them with the reference from Root servers seeking the IP address of the Authoritative DNS server responsible for the requesting domain name.
Step 4: At the last of the DNS process, there are Authoritative DNS servers. These reside in the domain and keep records about the subdomains of their domain. Once a TLD nameserver refers to an Authoritative nameserver’s IP address, the resolver reaches the respective Authoritative name server seeking the destination server’s IP address. Then only the resolver gets the expected destination IP address.
Higher nameservers such as Root, TLD and Authoritative nameservers are always iterative nameservers, which only respond to the requested query with its database rather than querying higher nameservers as recursive nameservers do.
Step 5: Now the resolver answers the client application with the destination IP address for the requested domain name so that the client application can communicate with the expected destination server. Also, the resolver keeps track of these IP addresses and relevant domain names and acts as a DNS cache when the same domain name query is requested.
Step 6: Finally, the client application can communicate with the expected destination server using the received IP address.
Now you know how the computers translate the URL you type on the address bar into a numeric IP address and reach the destination server. This article is only covering up to the DNS resolution process. Feel free to clarify any doubts about this article’s facts by commenting below.