In this article, we will discuss what is domain name system (DNS)? Why do we need DNS system? and How DNS works? so let’s discuss.
Table of Contents
DNS (Domain Name System)
DNS means Domain name system is a naming database that translates the domain name into IP address. It resolves the domain names on the Internet and finds out its IP addresses.
It is a system that is used to translate human-friendly domain names (such as google.com) into machine-readable IP addresses (such as 22.214.171.124) so that internet browsers can load internet services..
Actually, DNS is a directory lookup service, where all the domain names are mapped with the corresponding IP address and when we type a domain name on the browser, then the DNS server finds out its IP address in its directory and sends it back to the browser.
We open multiple websites every day (like- Google, Facebook, Youtube, etc.), and to open every website we never use the IP address, we always use domain names to open a website. DNS is like a phonebook, where all the IP addresses are stored and every IP address is linked with the domain name, so when we type a website address, the DNS automatically discovers the IP address for that website.
Why do we need DNS?
- On the internet, every device needs an IP address to identify and communicate with each other because IP addresses contain network id and host id, which helps to find the network and the host.
- When we type a website name on the browser for accessing that website, then we need that website’s IP address, only then our device can communicate with that website’s server, but it’s hard for humans to remember the IP addresses. So to solve this problem networking engineers developed a system called domain name system, where name servers are used to store all the domain names with their corresponding IP address.
What are the reasons for using DNS?
There are several main reasons why DNS is used on the internet:
Human-friendly names: The main reason for using domain names instead of IP addresses is because we humans can memorize names easily (like- TheStudyGenius, Google, Youtube, etc.), but it’s hard to memories numbers (like- 126.96.36.199), so we use a system called domain name system, which are the servers of domain names, used to map the domain names with the IP addresses.
Changing IP address: The second main reason for using DNS instead of IP address is because IP addresses are dynamic, they can be changed, means if we shift one hosting provider to another hosting provider, then the website IP address also be changed, but the website name (domain name) will be the same, that is possible because of domain name servers (DNS), where they update the IP address of the website.
Improving website performance: DNS can be used for load balancing, which helps distribute traffic across multiple servers to prevent any one server from becoming overwhelmed. This helps to ensure that websites and other online resources remain responsive, even during periods of high traffic.
Enhancing security: DNS can be used for implementing security measures such as DNSSEC, which adds an extra layer of authentication and helps prevent DNS spoofing attacks. Additionally, DNS-based firewalls and content filtering can be used to protect users from malicious websites and other online threats.
How DNS Works?
So now we will understand step-by-step how the DNS works.
Step-1: When we type a website like- Youtube.com in the web browser, then our browser needs the website’s IP address so our computer can communicate with the Youtube webserver because IP addresses contain host id and network id.
So to find the Youtube IP address first the computer checks the IP address in its own cache memory.
Step-2: If it’s not found in its own cache memory, then it will send the query to the DNS resolver.
The DNS resolver is basically a server, provided by our internet service provider (ISP). So when the DNS resolver receives the query, then it will check in its own cache memory to find the IP address of “Youtube.com”.
Step-3: If the DNS resolver doesn’t have the IP address, then the resolver will send the query to the root name server. So when the root name server receives the query for the IP address of “Youtube.com” from the resolver, then it sends the resolver to the .com Top-Level Domain (TLD) name server.
Step-4: So now the resolver asked to the .com top-level domain (TLD) server for the IP address of “Youtube.com”.
The TLD name servers are the servers that store the address information of the top-level domains such as- .com, .net, .org, and so on.
So when the .com TLD server receives the query for the IP address for “Youtube.com”, then it will direct the resolver to the authoritative name server.
Step-5: So now again the resolver will ask the authoritative name server for the IP address for “Youtube.com”. They are the final authority. So when the authoritative name server receives the query from the resolver, it will respond with IP address for “Youtube.com”.
Step-6: And finally the resolver will return to our computer with the IP address of “Youtube.com”, and now then our computer can communicate with the Youtube web server and can access the Youtube web page.
So once the resolver receives the IP address, it will store it in its cache memory, so now if the user again types “Youtube.com”, then it doesn’t have to go through all those steps again.
What is DNS Resolver?
A DNS resolver is basically a server, which provided by our internet service provider (ISP). It is designed to receive DNS queries from web browsers and other applications.
The DNS resolver receives the domain name and helps to connect the web browser of our computer to the DNS name servers.
It is responsible for tracking down the IP address of the given domain name for our web browsers. So web browser can communicate with the website’s server.
Actually, when a user searches a website name, then our computer needs that website’s IP address, so to find the IP address first it checks its own cache memory, if it’s not found, then our computer sends the request to our local ISP resolver (means DNS resolver), where it finds the IP address of a website if it finds the IP address, then its send back to our computer and if not, then the resolver tries to communicate with the DNS name servers.
What is Root Name Server?
DNS Root servers are the top on the root of the DNS hierarchy.
There are over 380 root servers worldwide, which are divided into 13 sets of groups, logically named as “Letter”.root-servers.net, where Letter ranges from ‘a’-to-‘m’,. Details of all root name servers can be found on the website www.root-servers.org.
These 13 groups of root servers are strategically placed all over the world and are operated by 12 different organizations.
Root name servers help us to find the specific top-level domain server.
Root servers don’t have the IP address of any website, but they have the IP address of all the top-level domain servers.
So if the resolver does not have the IP address of the domain name, then the resolver first sends it to the root name server, where the root server sends the resolver to the top-level domain name server.
For example: If we want the IP address of www.TheStudyGenius.com, then the root server knows which top-level domain server is responsible for all .com domains. So the root name server has the IP address of the .com top-level domain server.
What is Top-Level Domain (TLD) server?
TLD servers are the servers of top-level domains (like- .com, .net, .org, .edu, etc) which receive the query from the resolver server sent by the root server and give the IP information of authoritative name servers to the resolver.
TLD name servers store the IP information of authoritative name servers, which share the common domain extension.
So, .com TLD server stores all the IP addresses of authoritative servers, where all websites ending with the .com extension.
Similarly, .net TLD server stores all the IP information of .net authoritative servers and so on.
For example: When the .com TLD server receives the query for the IP address of the xyz.com, then that .com TLD server does not know the IP address of xyz.com, but it has the list of IP addresses of authoritative servers, where the resolver can find the IP address of xyz.com.
What is Authoritative Name server?
The authoritative name server is the last server in the DNS resolver, which stores the actual IP address of the requested website.
Authoritative server receives the query from the DNS resolver sent by the TLD server and gives the IP address of the requested website to the resolver. After that, the DNS resolver gives the IP address to our computer, so our computer can communicate with the website’s server.