Have you ever thought about what happens behind the scenes when you type google.com in your browser? I mean, how does your computer knows where to retrieve your data from? That is what I am going to explain to you in this article.
All electronic devices connected to the Internet has an IP address. An IP is like your social identification number, only your device has that number while you are connected. It is what makes you traceable on the web. If you want, you can check your IP address at http://whatismyip.host.
We can think that a DNS server is like a table with your domain name in one side and the IP address related to it in the other. You shall inform the domain (typing google.com in your browser or in the command line, for example) and the DNS server will retrieve the IP address related to it. If we didn’t have this middleware, you would need to access https://22.214.171.124 instead of https://google.com.
Behind the scenes, this is how it works
1 - Reach your Internet Service Provider
When you need a DNS resolution, first of all, you will reach your Internet Service Provider servers to request the IP address related to your domain (“hey, my expensive ISP, what is the IP address related to google.com?”).
2 - Find Root Servers
Your (expensive) ISP will then send your request to root servers, which will retrieve information about the top-level domains (TLDs), like “.com”, “.net”, “.br”, etc (“Hey, root servers, I need to know where shall I search information about .com domains”).
3 - TLD (Top Level Domain) Information
The root servers will provide DNS information about the TLD.
4 - Finding the IP address
After that, a search will be made on TLD servers to find the DNS for the requested domain (“Hey, TLD servers, where shall I search information about google.com?”).
5 - Almost done: Retrieving the IP address of the website
A search will be made on google.com DNS to retrieve the IP address (“Hey, google.com, which IP address do I need to reach to access your website?”)
6 - Finally, accessing the website
Now your browser is able to download the website files to load google.com (“Hey 126.96.36.199, I need you to send me the files to load this website”).
That is how stuff work on the backstage of the Internet! Be thankful for that, otherwise we would be writing on a notebook all IPs for every website that we are used to access.
- Domain Registrars, DNS, and Hosting: https://www.freecodecamp.org/news/domain-registrars-dns-and-hosting-353e4163a19
- Wikipedia - Domain Name System: https://en.wikipedia.org/wiki/Domain_Name_System
- How the Domain Name System (DNS) Works: https://www.verisign.com/en_US/website-presence/online/how-dns-works/index.xhtml