DNS 101
Tags: devops, dns
Published: 2022-10-29 17:32:21


---
title: DNS 101 
published: true
description: An explanation on how your browser translate a domain to an IP
tags: #devops #dns
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---

## What is DNS?

DNS or Domain Name System exists to resolve a domain (i.e. YouTube.com) to an IP address.

## Why do we need DNS?

We humans whenever we are accessing a site, we enter the domain name of the site. The reason is simple, names are much easier to be remembered over IP addresses.

Wouldn't it be weird when your friend gives you an IP address, when you ask him where you can purchase the tickets to The 1975's concert online.

Then, why do we need this you may ask?

Good!

Unfortunately, computers use IP addresses to identify one another on the internet, hence the DNS is for the computers!

Have you wondered what happens when you enter YouTube.com web browser?

DNS plays a major role here.

## How does DNS work?

Now that we know what and why do we need DNS, is time for the fun part.

How does DNS resolve youtube.com to an IP address?

Before we dive in to understand the flow, we will first need to understand the critical components that facilitate a successful resolution.

### Resolver

The Resolver is a server responsible to receive DNS queries and track down the IPs of the domain in each of the DNS queries for successful resolution.

Resolvers are usually managed and configured by our Internet Service Providers (ISPs) and are able locate the Root Server.

### Root Server

The Root Server is the first contact point for the Resolver in it's journey to resolve a domain.

Root server directs the Resolver to the appropriate Top Level Domain Server.


### Top Level Domain Server

Before we address what a Top Level Domain server is, let's first understand what a Top Level Domain is.

Top Level Domain refers to the last section of a domain name. For example the Top Level Domain of youtube.com is `.com` and web.mit.edu is `.edu`.

Each Top Level Domain has their own Top Level Domain server and they direct the Resolver to the Authoritative Name Server of the domain.


### Authoritative Name Server

The Authoritative Name Server is the final destination for the Resolver in the journey of resolving the domain, where it receives the IP of the domain being resolved.

How are the Top Level Domain servers aware of the Authoritative Name Servers?

That's easy, when we purchase a domain from a domain registrar (i.e. GoDaddy, NameCheap), the domain registrar usually provides a default Authoritative Name Server and it communicates that to the Top Level Domain server.

## Putting it all together 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i8hoeky63ydhv8k9z6m5.png)



1. User types YouTube.com in Web Browser and the request to resolve the domain is forwarded to the Operating System.

2. The Operating System forwards the request to the Resolver.

3. The Resolver queries the Root Server.

4. The Root Server responds to the Resolver's query by providing the address of the .com Top Level Domain Server.

5. The Resolver then queries the .com Top Level Domain Server.

6. The .com Top Level Domain Server responds to the Resolver's query by providing the address of the Authoritative Name Server.

7. The Resolver then queries the Authoritative Name Server of YouTube.com.

8. The Authoritative Name Server provides the IP address of YouTube.com to the Resolver.

9. The Resolver provides the IP address to the Operating System.

10. The Operating System provides the IP address to the Web Browser.

11. The Web Browser performs an HTTP request to the YouTube.com IP.

12. The Server at the IP which handles the requests to YouTube.com returns the webpage to be rendered in the Web Browser