🔍
👶 Kids📝 Blog About Contact 🚀 Get Started Free

DNS Explained

Learn how the Domain Name System translates human-readable domain names into IP addresses your computer can use.

What is DNS?

DNS (Domain Name System) is often called the "phone book of the internet." It translates human-friendly domain names (like codescompiler.com) into machine-readable IP addresses (like 185.199.108.153).

Without DNS, you'd have to memorize IP addresses instead of domain names to visit any website.

How DNS Resolution Works

  1. You type a URL — Your browser checks its local cache. If found, done!
  2. Recursive Resolver — Your ISP's DNS server (or Google's 8.8.8.8) receives the query.
  3. Root Name Server — Directs the resolver to the TLD server (e.g., .com, .org, .net).
  4. TLD Name Server — Directs the resolver to the domain's authoritative name server.
  5. Authoritative Name Server — Returns the actual IP address.
  6. Response — The IP address is returned to your browser, which connects to the server.

DNS Record Types

  • A Record — Maps a domain to an IPv4 address.
  • AAAA Record — Maps a domain to an IPv6 address.
  • CNAME — Alias for another domain (e.g., www → yoursite.com).
  • MX Record — Specifies mail servers for the domain.
  • TXT Record — Stores text data (used for verification, SPF, DKIM).
  • NS Record — Specifies authoritative name servers for the domain.
  • TTL (Time To Live) — How long a DNS record is cached before refreshing.

Public DNS Servers

  • Google — 8.8.8.8 and 8.8.4.4
  • Cloudflare — 1.1.1.1 and 1.0.0.1 (privacy-focused, very fast)
  • OpenDNS — 208.67.222.222

DNS Security

  • DNS Spoofing / Cache Poisoning — An attacker inserts false DNS entries to redirect users to malicious sites.
  • DNSSEC — DNS Security Extensions add cryptographic signatures to verify DNS responses.
  • DNS over HTTPS (DoH) — Encrypts DNS queries to prevent snooping.

What's Next?

Learn how web servers handle requests with HTTP & HTTPS, or explore how attackers manipulate DNS in Cyber Security.