DNS
A very famous question that you might often encounter is that what happens when you type a URL in a browser.
Before we answer this let's try to understand certain things about computers in a network.
Computers don't understand text, they understand numbers.
And we humans understand both but are familiar with remembering names.
Imagine your friend calling you using your phone number in a coffee shop. Not a bad idea though, you never know your future better half might just slide in your DM. Jokes apart!
We tend to remember names more than numbers and computers work with numbers.
So to bridge this communication gap DNS was invented.
DNS Stands for Domain Name System, it resolves domain names to IP addresses.
Even before your request reaches the designated server it goes through a number of steps.
When you type a URL in a web browser a computer tries to find the IP address in the browser's cache to find out whether the server you are requesting to has its IP mapped against the name.
You technically don't have to type the name of the website, you can just type the IP address if you know it and get your request served.
Let's take an example, if you type instagram.com then the browser would first check in its cache to find the IP address of Instagram server, if it finds then the request is directly sent to the instagram.com but if it doesn't find then the computer will check in its OS cache, if it doesn't even find in the OS cache then the Internet Service Provider (commonly known as Resolver server in the context of DNS) will check in its cache for the Instagram server's IP address.
If even the ISP is not able to provide/find the IP address from its cache then the request is routed to the Root server, which is at the top of the DNS hierarchy.
领英推荐
The Root server itself doesn’t have domain name to IP address mappings but it maintains IP addresses of the TLD servers — Top Level Domain servers and knows where to route the Resolver server to get the request answered.
There are 13 sets of these root servers which are strategically placed around the world to get the maximum output in the fastest time possible. Each set has their own unique IP address.
The Root server will then direct the Resolver to the TLD server - Top Level Domain server. TLD servers have entries of top level domain such as .com, .net, .gov, etc.
In our case the TLD server is a .com server which manages and stores information about the .com domains. TLD server stores IP addresses of the Authoritative Name server for all the domains under them.
The request is then routed to the Authoritative Name server which is responsible for knowing everything about the domain including the IP address.
Authoritative Server finds the IP and sends it back to the ISP (ISP also caches this entry to serve future requests to instagram.com) which in turn is forwarded to the computer from where the request was originated.
This computer can then establish the connection and start requesting for resources (usually the web page).
It is also essential to note that there is caching done at every layer/server/component to speed up the process for network efficiency and to save bandwidth.
Imagine having to go through all of these on every request you make on the internet. It is costly!
What you see within a blink of an eye is a very complicated process which is thoughtfully simplified for you by the smartest engineers around the world.
Imagine your internet life without DNS, even a thought of it is a nightmare!
MERN Stack Developer | Next.js | React Native | Angular | Vue.js | Laravel | CodeIgniter | Symfony | TypeScript | JavaScript | PHP | WordPress | jQuery | SQL | REST API | GraphQL | Redis | Docker | Git & Github
11 个月Thanks for posting