🔵

What is DNS?

  • The Domain Name System translates human-friendly hostnames into machine IP addresses.
    • Example: www.google.com172.217.18.36
  • DNS is a core component of the Internet.
  • Uses a hierarchical naming structure.
Example hierarchy:
  • .com
  • example.com
  • www.example.com
  • api.example.com

Key DNS Terminology

  • Domain Registrar – Service that manages domain name registrations (e.g., Route 53, GoDaddy).
  • DNS Records – Mappings like A, AAAA, CNAME, NS.
  • Zone File – File containing all DNS records for a domain.
  • Name Server – Resolves DNS queries (Authoritative or Non-Authoritative).
  • Top Level Domain (TLD).com, .us, .org, etc.
  • Second Level Domain (SLD) – The domain name before the TLD (e.g., amazon.com).

DNS Structure Example

Given http://api.www.example.com
  • Protocol: http
  • Subdomain: api.www
  • SLD: example
  • TLD: .com
  • Root: the invisible . at the end
  • FQDN: api.www.example.com.

How DNS Works

  1. Browser Lookup – Checks local DNS cache (TTL-based). If missing, queries the Local DNS Server.
  1. Local DNS Server – Usually managed by ISP or company; starts a recursive query if no cached record.
  1. Root DNS Server – Returns the name servers for the relevant TLD (e.g., .com). Managed by ICANN.
  1. TLD DNS Server – Returns the name servers for the SLD (e.g., example.com). Managed by IANA.
  1. Authoritative SLD DNS Server – Returns the IP address for the requested hostname.
  1. Final Response – Local DNS caches the IP and returns it to the browser, which connects directly to the web server.

Notes:
  • Each level of the hierarchy narrows the search.
  • DNS caching speeds up lookups and reduces load.
  • TTL controls how long a record is cached before it expires.