A general overview of the DNS
Here is a general overview of what the DNS is and how it operates
General Introduction:
Hey hey, WhatsUp!!!
Let me give you some context here.
Imagine, there you are, in front of your computer, trying to solve a problem that has been disturbing you for quite a while now, you are fed up and now want to change the strategy, instead of going on with the brainstorming, you resolve to research on google. you get to your web browser and type on the search “google.com”, then a few clicks and scrolls later, you can finally copy and paste the solution to your problem. now if you didn't know, you probably have just made use of the DNS right there.
Introduction to DNS
What is DNS?
DNS stands for (domain name services) which when translated to English just means a service that makes websites have user-friendly addresses.
You probably already know that the internet is the interconnection of millions of computers and servers around the world (if you didn't then now you do), and for data to circulate in this mushy mess of a network in all reliability, all of these devices must have unique identifiers or addresses, at the computer level these addresses are known as Ip addresses and are just a series of digits of the form 204.0.45.88.
Since the internet is meant to be used by humans, it is not obvious that people will willingly memorize a unique series of digits for each and every web service that they wish to access (given that I had a hard time memorizing my own phone number), there was therefore a need to make these addresses more human appealing thus the birth of Domain names, which in other words are human understandable names that are being mapped to IP addresses of web servers by, you guessed it, The DNS.
How does DNS work?
it all starts when you click on the enter button after typing a domain name like “google.com” in your browser’s search bar. These are the processes that occur thereafter.
the browser checks if it has the corresponding IP address for that domain name in the cache. if it does, it will directly make the query to the server at this address (in this case the DNS will not be involved), if not it will make a query to a local DNS resolver.
there are two types of DNS resolvers, iterative and recursive resolvers. your query will most likely be made to a recursive resolver so we will go with that for now.
The recursive resolver will make a query to a root nameserver around the globe, this server contains the information about top-level domain nameservers(TLDs) which are servers that holds information about domain names with the same top-level domains for example .com, .dev, .org, etc.
the root nameserver will make a query to the top-level domain nameservers that correspond to the domain name. this server will give information about the authoritative nameserver that has the information about this domain name, the authoritative nameservers are servers that contain detailed information about domain names including their IP addresses.
Finally, the authoritative nameserver returns the required IP address to the DNS resolver and the latter is sent back to the client which then finally makes the query to the server corresponding to this IP address.
Types of DNS resolvers:
There are two types of DNS resolvers:
recursive resolvers:
These resolvers follow the same process as detailed above, they initiate a query which is then called again multiple times by the different nameservers at the different levels of the nameservers hierarchy until the IP address is retrieved at the end.
This is a more effective pattern compared to iterative resolving because the path to the IP address is been determined effectively at every stage of the process and is not necessarily regulated or controlled by a central node or entity.
iterative resolvers:
Here, the resolvers follow a different pattern, it is like searching for a friend at a massive party, you ask John where Mary is and he tells you to ask Jake, then you ask Jake and he tells you to ask Lola and then you do before Lola tells you that Mary is right behind you(well… that's the best I could pull off as analogy for now).
In the same way, the resolver will query the root nameserver, then the latter will return information about the corresponding TLD server, then the resolver will now query the TLD server which will return the details about the corresponding authoritative nameserver(remember when I say corresponding here I mean in relation to the domain name for whom we are finding the IP address).
Finally, the resolver will query the corresponding authoritative name server which will return the desired IP address.
And then from there, the browser can now use this IP address to fetch the data or site it needs from the corresponding web server.
conclusion:
So now, I hope you have a better understanding of what DNS is and means, and that you will apply this knowledge to save the world(I mean… it's possible right?)
Yeah… there you go, leave your thoughts in the comments so I can learn from you too or answer your questions, and feel free to engage with me through my LinkedIn in my profile bio. till next time, happy coding.