DNS

Domain Name System (DNS) Overview

The Domain Name System (DNS) is a hierarchical system used to translate human-friendly domain names (e.g., www.google.com) into machine-friendly IP addresses (e.g., 142.250.190.14). DNS is essential for internet functionality, allowing users to access websites and services without memorizing numerical IP addresses.

Key DNS Concepts

  1. Hostname

A hostname is a unique name assigned to a device on a network. It is the first part of a Fully Qualified Domain Name (FQDN).

  • Example: In www.google.com, www is the hostname.
  1. Domain Name

A domain name is a human-readable identifier that maps to an IP address via DNS. It consists of multiple parts separated by dots.

  • Example: google.com is a domain name.
  1. DNS Zone

A DNS zone is an administrative segment of the DNS namespace managed by a specific entity. A domain can be broken into zones for easier management.

  • Example: example.com can have subdomains like blog.example.com and shop.example.com, each managed separately.
  1. Primary and Secondary DNS
  • Primary DNS Server: The main server that holds the original zone file with DNS records.
  • Secondary DNS Server: A backup that receives updates from the primary DNS and provides redundancy.
  1. Fully Qualified Domain Name (FQDN)

An FQDN is the complete domain name specifying its exact location in the DNS hierarchy. It includes the hostname and the full domain.

  • Example: www.example.com. (The dot at the end represents the root of the DNS hierarchy.)
  1. DNS Hierarchy

DNS follows a hierarchical structure with multiple levels:

  1. Root Level (“.”) – The starting point of DNS (handled by root name servers).
  2. Top-Level Domain (TLD) – The highest domain category (e.g., .com, .org, .edu).
  3. Second-Level Domain (SLD) – The registered domain name (e.g., google in google.com).
  4. Subdomain – A division of a domain (e.g., mail.google.com).
  5. Host – A specific machine or service (e.g., www in www.example.com).
  1. DNS Port
  • DNS primarily operates on UDP port 53 for quick, lightweight queries.
  • TCP port 53 is used for larger DNS responses (e.g., zone transfers).
  1. DNS Queries

A DNS query is a request sent from a client to a DNS server to resolve a domain name to an IP address.

Types of DNS Queries

  1. Recursive Query – The DNS resolver performs all lookups until it finds the answer.
  2. Iterative Query – The DNS server responds with a referral to another server, requiring multiple steps.
  3. Inverse Query – Resolves an IP address to a domain name (reverse DNS lookup).

Types of DNS Records

  • A Record – Maps a domain to an IPv4 address.
  • AAAA Record – Maps a domain to an IPv6 address.
  • CNAME Record – Creates an alias for another domain name.
  • MX Record – Specifies mail servers for email delivery.
  • PTR Record – Used for reverse DNS lookups.
  1. How DNS Works on the Internet
  1. User enters a URL (e.g., www.example.com) in a web browser.
  2. The request is sent to a DNS resolver (e.g., the ISP’s DNS server).
  3. If the resolver does not have the IP cached, it queries root name servers.
  4. The root directs the query to the TLD name server (e.g., .com servers).
  5. The TLD name server directs the query to the authoritative name server for example.com.
  6. The authoritative name server returns the IP address of www.example.com.
  7. The resolver caches the result and returns it to the user.
  8. The browser establishes a connection to the server hosting the website.

DNS Analogy: The Phonebook of the Internet

Imagine DNS as the phonebook of the internet:

  • You (the user) want to call “Pizza Place”, but you don’t know its phone number.
  • You look in the phonebook (DNS) to find “Pizza Place” (Domain Name).
  • The phonebook gives you the phone number (IP Address).
  • You dial the number, and your call connects to the restaurant (Website Server).

Just like a phonebook helps you find numbers instead of memorizing them, DNS helps translate domain names into IP addresses for easy internet navigation.