Comprehensive DNS Guide: An In-Depth Look

¡

4 min read

Hey all dns was one topic which troubled me for a long time and also became a hurdle for me in making a project🥲

Lets get over it and know DNS in-depth so we get a complete understanding of DNS.

What is DNS

DNS in a layman’s terms is a dictionary for short. A dictionary which can be used to find the IP of different-different sites we visit.

Computer don’t understand our language..

They do but actually they don’t 😁a dns gives our browsers the IP addresses of our sites whose names we can memorise easily. It is difficult for us to remember IP addresses and for computers its the opposite, they work seamlessly with numeric addresses.

DNS Domain Name Subsystem, which acts as a middle-man, they convert the something.com to 100:222:4023

How is it done?

Its simple you already know how to do it!!, you go to a dictionary for finding the meaning of a new word, the dictionary contains a huge chunkk of words and then you sagerigate the particular word that you’re interested in and get to know the meaning

Its the same concept with DNS! Simple right😉

Think of DNS as a huge dictionary which contains the list of key-value pair where the something.com is the key and the corresponding ip address/es are the response to that site.

But its a huge dictionary how do we segregate these many words?

We start filtering out the location on many basis such as start with the domain type .org or .com that clears our way and segregates the site addresses, for a more indepth understanding read article.

I hope you have read the article and now following up!!

Types of domains

  1. A record

  2. AAAA record

  3. CNAME record

  4. Naveserver (NS) record

1) A Record

A record is the most IMP record type, The ‘A’ in A record stands for ‘address’. An A record shows IP address for a specific hostname or domain.

eg.

TypeDomain NameIP Address
Aexample.com81.32.11.53

This gives direct IP address to a particular site name of what is mentioned.

It supports only IPV4 addresses.

2) AAAA record

AAAA record is same as the A record but it is an upgraded version of the A record as it also offers the IPV6 format for the ip address the newer protocols and more range of IP addresses it can handle.

3) CNAME record

CNAME is ‘canonical name‘ is like that spider man meme, one pointing to the other 😂, it gives the address to another domain whose ip it is refering to.

Didn’t understood ? I’m here to help

A CNAME record will map a domain name to another domain name (canonical name or target), When a client queries a DNS server for a domain name that has a CNAME record, the DNS responds with canonical name.

The client has to make a second DNS query to resolve the canonical name to an IP address.

Easy example:

You have a website hosted at example.com you want to create an alias blog.example.com that points to the same website. You would create a CNAME record like this:

blog.example.com. CNAME example.com.

What happens when user tries to access blog.example.com, the DNS resolution process would be:

  1. The client queries to a DNS server for blog.example.com

  2. The DNS server findds the CNAME record and responds with example.com.

  3. The client then makes a second query to the DNS server for example.com

  4. The DNS server responds with the IP address of example.com

  5. The client connects to the server using the IP address of example.com.

3) Nameserver record

A Nameserver (NS) record in DNS specifies which DNS servers are authoritative for a particular domain or subdomain.

It tells the internet where to go find the DNS records(like A, AAAA, MX,CNAME)

HOW IT WORKS?

When a DNS server needs to find information about a domain, it first queries the root servers to find the appropirate Top-Level Domain(TLD) servers(eg. .com, .org, .net).

Then… The TLD points to the authoritative name servers for specific domain using NS record.

This is the way a NS record is used to find the authoritative server.

E.G. => you want to find example.com. You want to use name server provided by your hosting provider, which are => ns1.hostingprovider.com ns2.hostingprovider.com and ns3.hostingprovider.com.

example.com. NS ns1.hostingprovider.com.

example.com. NS ns2.hostingprovider.com.

example.com. NS ns3.hostingprovider.com.

  1. Client resolver queries a root server.

  2. The root server directs the query to the .com TLD servers.

  3. The TLD server provides NS record for example.com “ns1.hostingprovider.com ns2.hostingprovider.com and ns3.hostingprovider.com.”

  4. The client’s resolver then queries one of these authoritative name server (e.g. ns1.hostingprovider.com)

  5. The client connects to the web server using the IP address.

Â