Hey guys, this is mahesh. Today we are going to learn what DNS is and how it helps to open a website on a computer.
So let’s start.
What Is DNS?
In the internet computers always identify each other with unique numbers called IP addresses. They do not understand human languages. If computers do not understand human languages, how they load a website, when we type its address in the web browser’s URL bar. That’s the place where DNS comes in. Suppose we speak English, and we want to communicate a person who speaks French. for effective communication, we will need a translator. Same is the case on the internet to computers or web browsers understand IP addresses. And we humans understand our languages say English. DNS acts as a translator between humans and computers. DNS or Domain Name System maintains a table where names are mapped to numbers, or more specifically, where websites domain names are mapped to their IP addresses.
Now, when we type google.com in the web browser, DNS translates it to the web browsers language that is IP address and gives it to the web browser. Now web browser understands that we want to access google.com. So it contacts the Google server and loads google.com on the computer.
In short, DNS acts as a phonebook of the internet via computer searches with names to get numbers.
How DNS Works?
So how DNS works internally. To understand this, we should know what our DNS servers are computers storing HTML files, images, sounds, videos for any other file types. Servers that work together to provide IP address of the requested website to the web browser are called DNS servers.
There are four types of DNS servers, DNS recursive resolver, or DNS resolver, root name server, top level domain or TLD name server and authoritative name server. DNS resolver is provided by the internet service provider. It connects the web browser of our computer to the DNS name servers. There are 13 sets of root name servers, logically named as letter dot root dash servers dotnet. We’re letter ranges from A to M, and are operated by 12 different organisations. Each set has a number of servers placed around the world and information page exists for all root name servers at address letter dot root dash servers dot o RG. We’re letter ranges from A to M, except g. for G This is the home page address. Details of all root nameservers can be found in the website WWW dot root desk servers dot o RG TLD name server stores the information of all domains sharing a common domain extension for example.com TLD name server stores the information of all websites ending with.com extension.net TLD name server stores information of all dotnet websites and so on. authoritative name server is the last server in the domain name system.
It stores the IP address of the requested website. authoritative name server for a website can be found with these CMD commands, open CMD and type ns lookup. Hit Enter set query equals ns and hit enter then type the domain name. Hit enter you will be able to see the authoritative name servers. One is master and the other is slave slave is the exact replica of master and is used to share the DNS server load. Now how a computer loads a website. Suppose we type facebook.com in the web browser. Since web browser needs IP address, so it forwards the query to the computer’s operating system. operating systems are configured to forward the query to the DNS resolver. operating system then context the DNS resolver. DNS resolver checks its cache whether it has the IP address of the requested website. If not, DNS query is forwarded to the root name servers.
Root name server checks the extension of the website whether it is.com dot o r g.net dot etc. Based on the extension the root name server provides the IP address of TLD name server to the DNS resolver In this case, IP address of.com TLD name server is provided to the DNS resolver DNS resolver, then context.com TLD name server, which then provides the IP address of the authoritative name server, which should necessarily store the IP address of the requested website.
Finally, the authoritative name server provides the exact IP address of facebook.com to the DNS resolver. DNS resolver stores this information in its cache for future use, and provides the IP address to the computer’s operating system. operating system then forwards it to the web browser. The web browser then contacts the Facebook server and loads the requested website that is facebook.com. But how TLD name server knows which authoritative name server stores the IP address of the requested website. It all begins when we purchase a domain name from a registrar for example, GoDaddy.
In registrar’s website, we can set the authoritative name server that domain should use. We get the details of authoritative name server when we buy a web hosting plan from companies like hostgator.
Once authoritative name server details are entered in the registrar’s website, registrar tells the TLD name server managing authority registry to update the TLD name server with the details of authoritative name server the user has provided. So now TLD name server knows which authoritative name server will provide the exact IP address of the requested website, however, is DNS necessery.
If we know the dedicated IP address of a website, we can access it simply by typing its IP address in the web browser. In such cases, DNS will not play any role because we already know the IP address of the website. However, as the number of websites increases, it becomes difficult to remember the IP addresses.
So DNS servers eliminate the need for humans to memorise these complex IP addresses. The only thing we need to memorise is the domain names, which are easier to remember.