DEV Community

loading...
Cover image for How do DNS work?

How do DNS work?

Mohammad S
..an electronics engineer experimentin' with web dev. 👨‍💻
・2 min read

Having been using the internet for a pretty lumpsum part of my life, the how's of how the internet works has always been intriguing to me. Skimming through YouTube videos on the same, yielded in a new word called DNS. So what exactly is DNS? And how does it play a role in the how's of the internet?

DNS? Well, it stands for Domain Name System. Let's dwell more into it.

We know that computers process through numbers. We visit a website by typing in words in the address bar. This gets converted into series of numbers called IP addresses by the DNS.

Browser Cache

DNS first looks up the browser's cache to see if it can find the website, and then proceeds to check up on the system cache of the OS.

Resolver

Now, if we DNS can still not find the website, it proceeds to send a request to the ISP (Internet Service Provider). Here, there is a resolver server which tends to search through it's cache. It then processes a request to the root server. The root server knows to locate the TLD (Top Level Domain) such as .COM.

But what if it it doesn't have the answer?

Root Server

The browser cache saves the information request, so that it does not need to ask the root server again. There are about 13 servers stationed all over the globe and the root servers sit on the top of the DNS hierarchy. These are operated by 12 different organizations and their name ranges from [letter].root-servers.net where the [letter] ranges from A to M.

There are plenty other organizations as well who provide physical servers distributed across. So fret not, the internet isn't solely dependent on the 13 servers alone.

Oh and the root server forwards the request to the other servers.

TLD (Top Level Domains)

TLD's belong the Internet Corporation for Assigned Names and Numbers (ICANN). Of which .COM is the earliest, dates back to 1985. These are available in country codes and 2 native languages as well!

Ok, but what did the other server respond to the request? Well, it seems to not have the website, but it gives the 'name servers'. So, now we have the authoritative name servers for our request.

Domain Registrar

The website domain can be purchased through the various domain registrars available (eg: goDaddy, etc.,). These registrar's communicate to the TLD's of the authoritative domain servers.

This information is stored with multiple domain registrars, for fast accessibility and safety during a crash or failure. You can run a WHOIS query and find the authoritative name server for your website.

Oh, and finally the domain registrar gives the IP address for the requested website. That's it.

Summary

Browser cache - OS cache - Request to ISP - Resolver server cache - Root server locates the TLD - Requests other servers - Receives authoritative name server - Domain registrar - IP address - back to the browser in a whoosh!

Hope this was simple!

Thank you for reading! :) Also, I document my journey and experiences on Twitter and LinkedIn.

Discussion (1)

Collapse
arvindpdmn profile image
Arvind Padmanabhan

Nicely summarized. Anyone looking for a little more detail, see devopedia.org/domain-name-system