Domain Name System (DNS)

Domain Name System (DNS)

Overview

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-readable domain names (like www.example.com) into IP addresses (like 93.184.216.34), allowing browsers and devices to locate and access websites and other online services.


How DNS Works

When you type a URL into your browser, DNS performs the following steps:

  1. DNS Query Initiation: The browser checks if the IP is already cached locally.
  2. Recursive DNS Resolver: If not cached, it queries a recursive resolver (usually provided by your ISP or a third-party like Google DNS).
  3. Root Name Server: The resolver first contacts a root name server (e.g., .) to locate the Top-Level Domain (TLD) name server.
  4. TLD Name Server: It responds with the location of the authoritative name server for the domain.
  5. Authoritative Name Server: This server returns the IP address associated with the requested domain name.
  6. Browser Connection: The browser connects to the IP address and loads the website.

DNS Components

  • Domain Name: A string like example.com.
  • IP Address: The numerical label of a device (IPv4 or IPv6).
  • Name Server: Stores DNS records and responds to queries.
  • Resolver: Intermediary that fetches records for the client.
  • Zone File: Contains mappings of domain names to IPs.

Types of DNS Records

Record TypePurpose
AMaps a domain to an IPv4 address
AAAAMaps a domain to an IPv6 address
CNAMECanonical name alias (e.g., www to root domain)
MXMail exchange servers for email routing
TXTArbitrary text (e.g., SPF, DKIM for email validation)
NSNameserver records for the domain
PTRReverse lookup from IP to domain
SRVDefines services (e.g., for SIP, XMPP)
SOAStart of Authority, contains domain admin info

DNS Hierarchy

  1. Root Level: Managed by IANA; represented as a dot .
  2. TLDs (Top-Level Domains): Examples: .com, .org, .net, .gov
  3. Second-Level Domains: Custom domains like google.com
  4. Subdomains: mail.google.com, support.microsoft.com

DNS Security

  • DNSSEC (DNS Security Extensions): Adds cryptographic signatures to DNS data to protect against spoofing.
  • DNS over HTTPS (DoH) and DNS over TLS (DoT): Encrypt DNS queries for privacy and integrity.

Popular DNS Providers

ProviderDNS Address(es)
Google DNS8.8.8.8, 8.8.4.4
Cloudflare DNS1.1.1.1, 1.0.0.1
OpenDNS208.67.222.222, 208.67.220.220
Quad99.9.9.9

Use Cases

  • Website access and browsing
  • Email delivery
  • VPN routing
  • Load balancing (via round-robin DNS)
  • Content delivery networks (CDNs)
  • IoT device communication

Fun Fact

The DNS system processes billions of requests daily, and the .com TLD alone contains over 150 million domain names!