Domain Name System

Swetha ravipudi
3 min readJun 23, 2021

Domain Name System(DNS) helps to resolve the names of the website with the underlying IP addresses. Every device go by an IP address just like the human’s go by a name. This IP address is essential for any communication on the network. It is like a telephone directory of the nineties. DNS uses User Datagram Protocol(UDP) on port 53 to serve requests.

To better understand it, let's consider the use-case of what happens whenever we type a URL in the browser and press enter.

In this example, the URL I am using is www.example.com.

URL in browser

Local Cache: When The URL is entered, the browser first checks in Browser Cache, if not found in the browser cache it immediately looks in the local DNS cache. If it finds it in the local DNS cache, it readily gets the IP address.

Local DNS lookup

ISP’s Resolving Name server: In case the URL is not found in the cache, the request is sent to Internet Service Providers(ISP) resolving name-server(NS). If the record is found in ISP's name server the IP is sent to the requester, otherwise, the request is sent to the root nameserver.

ISP Resolver Lookup

Root Domain Name-Server: If the IP is not found in the local cache or ISP’s cache root server is the first stop for all DNS requests. The root server(.) responds with the IP address of the top-level domain(TLD) server i.e .com,.net, .edu, etc…

Root Nameserver Lookup

TLD Server: The resolver then makes a request to the TLD server and it responds with the IP address of the domain name server.

TLD Server Lookup

DomainName Server: The resolver then sends the request to the IP of the Domain Name server and from here the exact IP of the website is sent to the DNS resolver.

Domain Name Server Lookup

Once the system receives the IP address further communication takes place between the client and the server.

If you want to quickly find the URL of any website use nslookup as shown below.

nslookup www.example.com

Types of DNS Queries:

Recursive Query: In this type, the DNS client provides a hostname/URL and the DNS resolver must provide an IP else it will result in an error.

Iterative Query: When the DNS client provides a hostname/URL the DNS resolver returns the best answer it can and route it to the appropriate server until the IP is resolved.

Types of DNS Records:

•A Record: It is also known as DNS host record, stores a hostname to IPV4 address mapping.

•AAAA Record: It stores a hostname to IPV6 address mapping.

•Canonical Name (CName) Record: Any alias to hostname can be specified as CName records.

•Mail Exchange (MX) Record: Used to specify SMTP email server for the domain.

I will detail the communication mechanism in another article and link it to this article.

Thank you for visiting. Have a great day!

--

--