The process of typing url to browser bar and then enter, wait for a little bit and you get your webpage in front of you seems like to be simple but there's a lot of communication and works between computers under the hood, and more amazingly, these complex stuffs are done in a time counted by just milliseconds!
When you type in the url, for example
gg.com to browser and go, the browser first will ask the DNS resolver (usually your ISP) if he saved a cached IP address
gg.com or not.
- If he say yes, he will return the IP address to the browser and then the browser can go to that address to fetch assets of
- If not, he has to proceed on finding the url's IP address
That process of IP finding is called DNS resolution.
Overall, the DNS resolver (now I will call it
resolver) has to scope down the zone of searching: he will search for where is containing all the
.com domains among others (
.co,...) first, then go to that
.com domains container and search for
gg.com's address and finally go to that final address to retrieve assets.
- The resolver asks the first information bar (rootname server) where contains all the
.comdomains, the RS returns the IP address of the
.comcontainer - this container's address is called Top Level Domain server.
- The resolver goes to the Top Level Domain server address, asking for the address of
gg.com. The TLD server returns the IP address where containing the
gg.comdomain - This address is called authoritative name server, the information bar knows where
- The resolver go to the Authoritative name server, asking the exact address of
gg.com, the ANS return the exact IP address of
- Having the final IP address of
gg.com, the resolver saves that IP address for a limited time (cached), then tell the browser "hey, this is where
gg.comlives, go here to find him".
- Browser go to that IP address and retrieve
Next time when we want to access
gg.com, the resolver will check if there's a time-valid cached IP address of
gg.com or not, if the cached IP is not obsolete the resolver will return that cached IP to browser, or else it will start the DNS resolution process.
- DNS servers communicate with address in IPs type, not human url.
- An IP address points to a specific computer containing the url's assets (HTML, CSS, JS files).
- A certain url can have multiple IP address in ANS, each of these IP address is called A record. When requested, the ANS will choose 1 of these
A recordsand return to resolver. By doing this the loads among servers containing assets of the url can be shared and balanced and avoid failures when one or more of the servers are down. For example: beside
22.214.171.124, the IP address of
126.96.36.199. We can go to one of them to get the same assets for