Domain Name System 0x1

Domain Name System 0x1 | DNS 101

TheBitDoodler's Byte
InfoSec Write-ups
Published in
5 min readJan 14, 2023

--

Hey techies, you’ve come to the right place if you’re looking to learn about or refresh your knowledge of DNS. We will be providing a simplified explanation of the concept. Our aim with this blog is to provide a basic understanding of the Domain Name System. We will cover topics such as:

What is DNS?

Domain Hierarchy

Types of DNS Server

How DNS Works?

What is DNS?

The Domain Name System (DNS) is an essential component of the internet that is responsible for converting human-friendly domain names into IP addresses that computers can understand. Without DNS, we would have to remember and type in long strings of numbers to access websites, which would make the internet a lot less user-friendly.

We all know in the Internet every connceted device gets some unique indentities, one of such is an IP address that can be of 64bits(IPv4) or 128bits(IPv6) in size.

An IPv4 address looks like 172.67.177.148, 4 sets of digits ranging from 0–255 separated by a period.

For example when we want to visit an website, it is not possible to remember the aforementioned complicated set of numbers and that is where DNS come to play. So instead of remembering 172.67.177.148, we can remember securityzines.com.

A name is simpler for a human to remember than a number hence the DNS. In a layman language DNS provides a uncomplicated way to communicate with devices on the internet without remembering complex numbers. We can also think it as an a unique address for sending mail directly to it.

Domain Hierarchy

DNS is a hierarchical system, with the highest level being the top-level domain (TLD) and the next level being the second-level domain (SLD). TLDs include the most common ones(Generic Top-Level Domains or gTLDs) such as .com, .org, .edu, .gov, and Country Code TLDs or ccTLDs such as .us, .uk, .fr, etc. SLDs are the domain names that come before the TLD, such as “securityzines” in “www.securityzines.com".

Due to huge demand there IANA has added more generic TLDs like .online,
.biz, .app and so on.To get the full list(2000)visit the following link
- https://data.iana.org/TLD/tlds-alpha-by-domain.txt
Domain Heirarchy

Types of DNS Server

If we want to browse any website let’s say securityzines.com, first our web browser will try to fetch the A record(IPv4 address mapped with a domain name) of the domain. In this process there 4 DNS servers are involved to fetch the corrosponding IP address.

Recursive Resolver / Server

A recursive resolver is a type of DNS server that is responsible for resolving domain names on behalf of clients. It acts as an intermediary between the client and the DNS hierarchy, and its main function is to follow the series of steps required to resolve a domain name to an IP address. It is typically provided by ISPs or large companies and its used by clients on the local network.
When a client, such as a web browser, sends a request for a domain name to a recursive resolver, the resolver first checks its cache to see if it already has the IP address on file. If it does, it returns the IP address to the client and the process is complete.

Root Nameserver / DNS Server

The root nameserver is essential for the functioning of the DNS system. It acts as a central hub that directs requests to the appropriate TLD nameservers and it allows the DNS system to be organized in a hierarchical manner. This makes it possible for the DNS system to handle the large number of domain names that exist on the internet.
The root nameservers are operated by a group of organizations known as the “root server operators” and their IP addresses are hardcoded into the DNS resolvers, which is why it is not necessary to specify a root nameserver when configuring a DNS resolver.

TLD Nameserver / DNS Server

A TLD (top-level domain) nameserver is a type of DNS server that is responsible for managing a specific TLD and providing information about the domain names within that TLD. TLDs include the most common ones such as .com, .edu, .gov, and country code TLDs such as .us, .uk, .fr, etc.
The TLD nameserver is responsible for directing the request to the appropriate second-level domain (SLD) nameserver, which holds the information for the specific SLD being requested. The TLD nameserver also manages the registration and delegation of domain names within its TLD.

Authoritative Nameserver / DNS Server

An authoritative nameserver is a type of DNS server that is responsible for providing the final and definitive answer to a DNS query. The answer provided by an authoritative nameserver is considered the “authoritative” answer for the domain name being queried.
An authoritative nameserver holds the zone file for a specific domain name, which contains information such as the IP addresses of the domain’s web and email servers, and the domain’s MX records. The zone file is used to generate the DNS records for the domain name and it is often stored on multiple nameservers to provide redundancy and improve reliability.

How DNS Works?

We will understand with a simple example:

  1. “When we type “securityzines.com” into the address bar of a web browser and hit enter, the sub-resolver begins by checking the /etc/hosts file for the IP address associated with the domain. If it’s found, it returns the mapped IP address.
  2. Else, the query request is forwarded to the DNS resolver, which is typically provided by the internet service provider (ISP).
  3. The resolver checks its cache to see if it already has the IP address for “securityzines.com” on file.
  4. If the IP address is found in the cache, the resolver returns it to the browser, and the browser uses it to connect to the website.
  5. If the IP address is not found in the cache, the resolver sends a request to the root nameserver.
  6. The root nameserver directs the resolver to the TLD (top-level domain) nameserver for .com.
  7. The .com TLD nameserver directs the resolver to the authoritative nameserver for the “securityzines” domain.
  8. The authoritative nameserver for “securityzines.com” returns the IP address associated with the domain to the resolver.
  9. The resolver returns the IP address to the browser, and the browser uses it to connect to the website.
  10. The browser makes a request to the server hosting “securityzines.com” and the server returns the HTML,CSS,JS and other files to the browser, which then renders the website for us to see.
How DNS Works

To visulalize the process I have also created a Flyer explaining the whole process, check it on SecurityZines - Link

I hope this blogs helped you to clear the concepts about the basic part of DNS. In the next blog we will understand various DNS Records.

--

--