How DNS (Domain Name System) Works and Queries Get Resolved

Gaurav Gupta
3 min readSep 8, 2019

--

All URLs map to an IP address. When you request a URL, you are actually instructing the system to find the IP address that is associated with the URL, and then the computer connects to that IP address. It follows a system of lookups to map the URL to the IP starting with your computer and ultimately reaching the master list on the top-level domain server. This process happens countless times per day for people all over the world, and we will walk through it step-by-step..

Whenever you type any URL or access any website for example,by typing http://whizlabs.com or https://gitconnected.com into your address bar, the browser will check the IP address of the requested URL in the local cache on your computer. If it does not exist then it passes the request to the Name Resolving Server. Usually, the Name Resolving Server is your Internet Service Provider (ISP).

Name Resolving Server — ISP

The Name Resolving Server (usually the ISP) will then check its local cache of URL=>IPs mapping. If the ISP doesn’t find the IP address of whizlabs.com in its local cache, it passes the request to Root Server. The Root Server tells you the IP address of the Top Level Domain (TLD) Server which points to the master list of domains. There is a TLD for all the domain types (.com, .io, .net, etc) and here we would be looking for the “.com” domain TLD.

Now the Name Resolving Server (your ISP) passes the request to the TLD Server and asks for the IP address of http://whizlabs.com. The TLD server responds with the address of the master “.com” list in its domain server.

Now the Name Resolving Server passes the request to Domain Name server i.e the .com Domain server, which responds the IP address of http://whizlabs.com

Finally, the Name Resolving Server (ISP) passes the response to your computer.

The Name Resolving Server caches the IP address of http://whizlabs.com for a specific time-to-live (TTL) so that it wouldn’t have to perform the same operation again. But once this TTL gets expires, the Name Resolving Server has to perform the entire process from beginning.

Process Summary:

  1. Computer: Use its own cache — If not found, move to step 2.

2. Name Resolving Server: Checks Name Resolving Server Cache — If not found, move to step 3.

3. Root Server: Get the Top Level Domain server IP address and tell the Name Resolving Server — Got TLD Server Address. Move to step 4.

4. TLD Server: Got the .com Domain Server IP address and give it to Name Resolving Server. Move to Step 5.

5. .com Domain Server: Got http://whizlabs.com server IP address. Pass this to Name Resolving Server and cache it. Pass this to the computer and cache it.

And now you have access to the website!

--

--

Gaurav Gupta
Gaurav Gupta

No responses yet