How the Domain Name System (DNS) Works: A Comprehensive Guide
What Happens When You Enter a URL?
When you type a URL into your browser’s search bar, a complex but efficient process unfolds behind the scenes to translate that human-readable address into a computer-friendly IP address. This process, known as DNS resolution, involves multiple steps and components working together to connect you to the desired website.
The Domain Name System (DNS) is a hierarchical and decentralized naming system for computers, services, and other resources connected to the Internet or a private network. It translates human-friendly domain names (like www.example.com) into IP addresses (like 192.0.2.1) that computers use to identify each other on the network. This translation is crucial because while domain names are easy for humans to remember, computers and networking equipment rely on numerical IP addresses to locate and communicate with each other.
Components of DNS
Domain Names:
- Structure: Domain names are structured hierarchically from right to left. The rightmost part is the Top-Level Domain (TLD) such as .com, .org, or .net. The part before the TLD is the domain name, and there can be multiple subdomains.
- Example: In the domain name
www.example.com
,com
is the TLD,example
is the second-level domain, andwww
is a subdomain.
DNS Zones:
- Definition: A DNS zone is a distinct part of the domain name space managed by a particular organization or administrator.
- Types: There are different types of zones such as primary (master), secondary (slave), and stub zones.
Name servers:
- It’s important to understand that the DNS isn’t a single server. It’s a complete infrastructure with numerous servers. DNS servers that respond to users’ queries are called name servers.
Resource Records (DNS Records )
- The DNS database stores domain names to IP address mappings in the form of resource records (RR). The RR is the smallest unit of information that users request from the name servers. There are different types of RRs. The table below describes common RRs. The three important pieces of information are type, name, and value. The name and value change depending on the type of RR.

Now let’s look at individual records of Resource Records
A(Address) Record:
An A record maps a domain or a subdomain to its server’s IP address (IPV4). The same domain or subdomain can be mapped to multiple IP addresses.
In order to make your system fault-tolerant, add multiple entries of the A records with the same domain or subdomain but different IP address values.
let’s see how can I find A record for any website in our computer
fire up the terminal in windows
nslookup -type=A nykaafashion.com
here i am trying to find the Address type of record for the nykaafashion.com

Let’s see the output.
Command Breakdown
nslookup
: This is a command-line utility used to query Domain Name System (DNS) servers to obtain domain name or IP address mapping.-type=A
: Specifies that you're looking for "A" records, which map domain names to IPv4 addresses.nykaafashion.com
: The domain name you're querying.
Output Explanation:
- Address:
192.168.43.1
is the IP address of the DNS server thatnslookup
is used to perform the query. This address is a private IP address, likely your router or local DNS resolver provided by your ISP or local network. - Non-authoritative answer: This indicates that the response is from a DNS server that is not the authoritative source for the domain. Instead, the information is being relayed from a cache of another DNS server. we will talk about this thing in DNS caching.
- Name: The domain name you queried,
nykaafashion.com
. - Addresses: The list of IP addresses associated with
nykaafashion.com
. These are the A records returned by the DNS server.
These are IPv4 addresses to which the domain nykaafashion.com
resolves. Having multiple IP addresses is common for load balancing and redundancy purposes. It allows the domain to distribute incoming traffic across several servers, improving availability and performance.
Now let’s look at how can I find the NS (Name Server ) record for the website

instead of record type A here we are giving type=NS. It means name server.
These are the authoritative nameservers for the domain nykaafashion.com
. They are part of Amazon Web Services (AWS) DNS infrastructure. AWS provides robust and scalable DNS services through its Route 53 service. The naming convention (awsdns
) indicates that these servers are managed by AWS.
The nameservers listed (ns-1055.awsdns-03.org
, ns-1945.awsdns-51.co.uk
, ns-281.awsdns-35.com
, ns-654.awsdns-17.net
) are authoritative DNS servers managed by AWS Route 53. They do not host the actual content of the nykaafashion.com
website. Instead, they provide the necessary DNS records that allow DNS resolvers to locate and connect to the content hosting servers where the actual website content is stored and served to users.
Content Hosting vs. DNS Hosting
Content Hosting:
- Refers to servers that store and serve the actual content of a website (HTML, CSS, images, videos, etc.).
- These are web servers that handle HTTP/HTTPS requests from browsers.
DNS Hosting:
- Refers to servers that store DNS records and handle DNS queries.
- These nameservers (like the AWS Route 53 servers listed) are responsible for directing traffic to the appropriate content hosting servers by providing the necessary IP addresses or other records.
Let’s see CNAME Record for the website
CNAME record
A CNAME record maps a particular domain or subdomain to another hostname.

CNAME Record: www.nykaafashion.com
is a canonical name (CNAME) for www.nykaafashion.com.cdn.cloudflare.net
.
- This means that when you access
www.nykaafashion.com
, DNS resolution will redirect you towww.nykaafashion.com.cdn.cloudflare.net
. - cdn.cloudflare.net indicates that Cloudflare is providing content delivery network (CDN) services for
www.nykaafashion.com
. This setup helps improve the performance and security of the website by distributing its content through Cloudflare's global network of servers. This CDN is topic for another day. For now CDN is content distribution.
Uses of CNAME
- It provides different hostnames for different types of servers such as mail server, email server, etc.
- Subdomains use the CNAME record to redirect users to the host domain.
- By using CNAME records, you can redirect users to the most ideal server within their country such as google redirects users of the UK to google.co.uk and users of India to https://www.google.co.in/
nameserver vs A record in dns
A name server is a specialized server on the internet that handles queries about the location of domain names’ various services. It is responsible for responding to DNS queries about domains.
An A record is a DNS record that maps a domain name to its corresponding IPv4 address.
see the below image A records are mapped to IP and cnames are mapped domain names.

you can also use this website https://www.nslookup.io/ to see the DNS records for a particular website.
How are DNS names processed? For example, will https://www.nykaafashion.com/ be processed from left to right or right to left?
- DNS names are processed from right to left. In the case of educative.io, the resolvers will first resolve the
.io
part, theneducative
, and so on.
Visually, however, the DNS hierarchy can be viewed as a tree. we will see that.
How DNS works?
- How is the DNS hierarchy formed using various types of DNS name servers?
- How is caching performed at different levels of the Internet to reduce the querying burden over the DNS infrastructure?
- How does the distributed nature of the DNS infrastructure help its robustness?
DNS hierarchy
There are mainly four types of servers in the DNS hierarchy:
For the domain www.mail.example.com
:
- Root Level:
.
(implicit) - TLD (Top level domain):
.com
- SLD(second level domain):
example
- Subdomain:
mail
- Host: Specific server for
www.mail.example.com
(e.g., an IP address)

When a user types www.google.com
into their browser, the DNS resolution process occurs as follows:
- Query the Root Server:
- The DNS query starts at the root level, which directs the request to the appropriate TLD server.
- The root server responds with the address of the TLD server for
.com
.
2. Query the TLD(Top level domain ) Server:
- The DNS query is then sent to the
.com
TLD server. - The TLD server responds with the address of the SLD server for
google
.
3. Query the SLD (second level domain) Server:
- The DNS query is sent to the SLD server for
google.com
. - The SLD server responds with the address of the subdomain server for
www
.
4. Query the Subdomain Server:
- The DNS query is sent to the subdomain server for
www.google.com
. - The subdomain server responds with the IP address of the host, which in this case might be
172.217.14.206
.
5. Return IP Address:
- The DNS resolver returns the IP address to the browser.
- The browser uses this IP address to establish a connection and retrieve the webpage.
There are two ways to perform a DNS query:
- Iterative: The local server requests the root, TLD, and the authoritative servers for the IP address.
- Recursive: The end user requests the local server. The local server further requests the root DNS name servers. The root name servers forward the requests to other name servers.

Caching
Caching refers to the temporary storage of frequently requested resource records. A record is a data unit within the DNS database that shows a name-to-value binding. Caching reduces response time to the user and decreases network traffic.
Caching can be implemented in the browser, operating systems, local name server within the user’s network, or the ISP’s DNS resolvers.

Let’s see caching at OS level in
fire up the terminal and type
ipconfig /displaydns
these are all the caches stored in my OS. I have these because they are the sites that I have accessed.

DNS cache at browser level
chrome://net-internals/#dns
enter that URL in Chrome and just enter the site you wanted to know.
I hope you all found this helpful. Please like and follow for more content. Thanks!
Happy Learning😃!!!!!!