@rkenmi - DNS

DNS


DNS


Back to Top

Updated on March 15, 2021

DNS (Domain name system) is essentially a phonebook for internet addresses on the Internet. Every URL with alphanumeric characters are mapped to IP addresses, either IPv4 or IPv6. That means https://google.com is actually an address like 68.128.104.99 (IPv4) or 2001:558:4000:25::1 (IPv6).

What happens when you go to google.com?

  1. The user types in google.com in the browser and hits enter. The browser first looks up its local cache to see if google.com is in its DNS cache. If it's in the cache, it now has the IP address and it can start communicating to that endpoint (to fetch a HTML generated response for the Google page)

  2. If there is no google.com in the local DNS cache, then it has to find it somewhere. It now goes to the ISP's DNS resolver or DNS server, by default. This means that if you have Comcast, then you'll be relying on Comcast's DNS server to find that IP address for google.com. Since there are millions, if not billions of users with Comcast as their ISP, you could expect the DNS server to be highly available with a lot of cached entries in its DNS entries. This also means Comcast can track which websites you go to, so if you want more privacy, you could consider using other public DNS server instead.

  3. If google.com was not in the entries of Comcast's DNS server, nor the local DNS cache, then the resolver will now need to knock on the door of the DNS root server. DNS root servers are strategically placed around the world, with only 13 in existence. Each one has a unique IP address. They are called root servers because they are at the top of the DNS hierarchy.

    Unfortunately though, they won't have the IP address for your google.com. Instead they will redirect the DNS resolver to the TLD server.

  4. TLD stands for Top Level Domain server, and as you can imagine, it relates to domains such as .com, .org, .net, and etc. The DNS root server redirects the DNS resolver to the appropriate TLD server. In this case, since our query is google.com, we'll be looking at the .com TLD server. But tough luck; the .com TLD server won't have your IP address either! Instead, the TLD server contains a mapping of google.com to its authoritative name servers. So now, the DNS resolver is redirected to the authoritative name server.

  5. The authoritative name servers have all the information about a particular domain. Finally, the name servers will understand what google.com means, and it will return an IP address back to the resolver. The DNS resolver made an expensive journey to fetch this IP address, so it will cache it so that other Comcast users don't have to go through the same struggle again.


Article Tags:
dnsnetworking