URL is nothing but the Uniform Resource Locator that is the address of the website, which we enter in the address bar(guvi.in). On the other hand, the DNS (Domain Name System) is the database that links the URL with a particular IP address. The IP address comes from the computer server that hosts the website’s server. So, we request access to a website by typing the URL, and DNS maps the URL to the IP address we are requesting.
URLs make our life simpler by mapping the IP address with the name of the website (18.104.22.168), and we know that remembering the IP of each and every website is not possible.
So, the browser first checks for cache to get the DNS record
- Our browser will maintain a repository of DNS records for a limited time that we have visited before.
- The browser then will check for OS cache (OS maintains the DNS records too)
- The next step is to search the router cache (when the DNS record is not available in the OS cache)
- The final hope is the ISP (Internet Service Provider) cache. The cache is maintained at various levels which may not be ideal for your data privacy but helps in regulating traffic and hasten the transfer of data.
- When the ISP cache is not available too, then the DNS server initiates a DNS query to find the IP address of the server that hosts the website we are looking for and this DNA query searches different DNS servers on the internet till it finds the correct IP (recursive search). The requests are sent through small packets of data. An optimization for the fastest routing is done. We will get an error if the packets get lost.
- TCP connection with the server is initiated by the browser and then a TCP connection is established.
- HTTP request to the webserver is made by the browser
- The server will send the response