What is DNS? | How DNS works?
Domain Name System(DNS) is a hierarchical and decentralized naming system for computers, services, or other resources connected to the Internet or a private network.
Working of DNS:
If you search a website(eg: https://abhayjain13.github.io), the Browser and Operating System(OS) both search their cache first. But since they didn’t know as it is a new search, the OS will be calling the Resolver.
The Resolver server is basically an Internet Service Provider(ISP).
Resolvers know where to locate the Root server.
The Root server is just one of the 13 root name servers that exist today. Root servers sit at the top of the DNS hierarchy.They are scattered around the globe.
The Root server knows where to locate the Top Level Domain(TLD) server. They found the name servers of the website. Before moving ahead, it stores this information, so it won't have to look again.
The coordination of most TLDs belongs to the Internet Corporation for Assigned Names and Numbers(ICANN). The .com TLD was one of the first created in 1985.
The TLD found the Authoritative name servers for the domain and give that to Resolver. Now how to make a connection as there are multiple .com domains. Easy! With the help of the Domain Registrar!
When a domain is purchased, the Domain registrar reserves the name and communicates to the TLD registry, Authoritative name servers(No cached values, the real deal).
Resolver communicates with the Authoritative name server and gets the list of some unknown order of IP address (eg: https://ns1.abcdefghij.io, https://ns2.abcdefghij.io). There are multiple addresses because the workload is better distributed. Resolver then saves this data and gets back to OS. OS saves this data too, so it won’t have to bother Resolver again if he asks for the same domain in the future.
Finally, the Browser starts displaying the data to the audience while you were away.
But what if there are many subdomains, so for that when the resolver asked the TLD about the domain, extra information was attached to that response. This is known as Glue Records. The resolver got at least one IP address for each name server. Thus breaking the circular dependency.