DNS in a Nutshell

Can Özkan
3 min readFeb 5, 2024

DNS, or Domain Name System, is a hierarchical and decentralized naming system used to translate human-readable domain names into numerical IP addresses. The primary purpose of DNS is to simplify the process of accessing websites and other resources on the Internet by allowing users to use easily memorable domain names instead of numerical IP addresses.

Domain Names

Every device connected to the Internet, such as a host, computer, server, or any networked device, has an IP address. However, IP addresses are not easy for humans to remember. Therefore, domain names were introduced to provide a more user-friendly way to identify resources on the Internet.

DNS Servers

DNS relies on a distributed system of servers to store and manage domain name information. There are several types of DNS servers, including:

  • Root DNS Servers: The highest-level DNS servers store information about top-level domains (TLDs).
  • TLD DNS Servers: These servers store information about specific top-level domains like “.com,” “.org,” or country-code TLDs like “.uk” or “.tr.”
  • Authoritative DNS Servers: These servers store information about individual domains, such as example.com, and provide the final answer when translating a domain to an IP address.
  • Recursive DNS Servers: These servers are responsible for making DNS queries on behalf of clients, recursively resolving queries until they reach an authoritative DNS server.

How a DNS Query Works

When a user enters a domain name in a web browser, the DNS resolution process begins:

  1. The client device sends a DNS query to a local DNS resolver (usually provided by the ISP).
  2. If the local resolver has the information in its cache, it returns the IP address to the client.
  3. If not, the local resolver forwards the query to a recursive DNS server.
  4. The recursive DNS server starts querying the root DNS servers to find the authoritative server for the TLD.
  5. Once the authoritative server for the TLD is found, the recursive server queries it to find the authoritative server for the specific domain.
  6. The final authoritative DNS server provides the IP address associated with the requested domain.
  7. The IP address is then returned to the client, and the client can establish a connection to the desired server.

DNS Record Types

DNS records are stored on authoritative DNS servers and contain information such as IP addresses, mail server addresses (MX records), text records (TXT), and more. These records are essential for the proper functioning of the DNS system.

A (Address) Record: The A record maps a domain name to an IPv4 address. For example, if you have the A record for “www.example.com" pointing to the IP address “192.168.1.1,” when someone enters “www.example.com" in a browser, it is translated to the associated IP address for routing purposes.
AAAA (IPv6 Address) Record: Similar to the A record, the AAAA record maps a domain name to an IPv6 address. It is used when the domain needs to resolve to an IPv6 address instead of an IPv4 address.
CNAME (Canonical Name) Record: The CNAME record creates an alias for a domain. It points one domain to the A record or AAAA record of another domain. This is often used for creating subdomains or for load-balancing scenarios.
MX (Mail Exchange) Record: MX records specify the mail servers responsible for receiving emails on behalf of the domain. Each MX record has a priority value, and mail servers will attempt to deliver emails to the server with the lowest priority first.
TXT (Text) Record: The TXT record is used to store arbitrary text data associated with a domain. It is often used for various purposes, such as domain verification, SPF (Sender Policy Framework) records for email authentication, and human-readable information.
PTR (Pointer) Record: PTR records are used for reverse DNS lookups. They map an IP address to a domain name, providing the reverse mapping of an A or AAAA record.
NS (Name Server) Record: NS records delegate a domain to a specific authoritative DNS server. They specify which DNS servers are authoritative for a particular domain.
SOA (Start of Authority) Record: The SOA record contains essential information about the domain and the zone. It includes details such as the primary authoritative DNS server, the email of the domain administrator, the domain serial number, and timers for refreshing and expiring data.

Thanks for reading.

Can Özkan

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Can Özkan
Can Özkan

Written by Can Özkan

Security Researcher, Penetration Tester, and Reverse Engineer

No responses yet

Write a response