Skip to main content

Module 12: DNS Deep Dive

DNS (Domain Name System) is often called the “phonebook of the internet,” but it is more accurately the internet’s distributed directory service. Unlike a phonebook (which is a single, static document), DNS is a globally distributed, hierarchical, real-time database that handles trillions of queries per day. This module takes you from basic understanding to mastering DNS architecture, record types, troubleshooting, and security. A better analogy: DNS is like the information desk network at a large airport. You ask the first desk “Where is Gate B42?” They do not know, but they say “Go to Terminal B information.” Terminal B information says “Gate B42 is in Concourse B-East, ask the desk there.” The Concourse B-East desk finally tells you “Gate B42 is down the hall, third on the left.” Each desk only knows about its own area, but by following the chain, you get your answer. And crucially, you remember the answer for next time (caching) so you do not have to ask again.
DNS Resolution Flow
Estimated Time: 4-5 hours
Difficulty: Intermediate
Prerequisites: Module 6 (Application Layer basics)

12.1 Why DNS Matters

Without DNS, you’d need to memorize IP addresses:
DNS translates human-readable names to machine-readable IP addresses.

12.2 The DNS Hierarchy

DNS is a distributed hierarchical database, not a single server.

DNS Components


12.3 DNS Resolution Process

Step-by-Step: Resolving www.example.com

1

Browser Cache

Browser checks its local DNS cache.
2

OS Cache

Operating system checks its DNS cache.
3

Recursive Resolver

Query is sent to configured DNS resolver (usually ISP’s or 8.8.8.8).
4

Root Server Query

Resolver asks a root server:
5

TLD Server Query

Resolver asks the .com TLD server:
6

Authoritative Server Query

Resolver asks the authoritative server:
7

Response to Client

Resolver caches the answer and returns it:

Visual Flow


12.4 DNS Record Types

Essential Records

Record Examples

Advanced Records


12.5 TTL (Time To Live)

TTL determines how long DNS records are cached.

TTL Trade-offs

TTL Strategy for Migrations

This is one of the most important operational patterns in DNS management. Getting it wrong can cause hours of downtime.
The classic mistake: Changing the DNS record without lowering the TTL first. If the TTL was 86400 seconds (24 hours), some users will continue hitting the old IP for up to 24 hours after the change, regardless of what you do. There is no way to force a cache flush on every resolver worldwide. The only defense is to lower the TTL before the migration and wait for the old TTL to expire.

12.6 DNS Zones

A zone is a portion of the DNS namespace managed by a specific organization.

Zone File Example

Zone Types


12.7 DNS Propagation

When you change DNS records, the change doesn’t happen instantly worldwide.

Why Propagation Takes Time

Propagation Timeline

Checking Propagation


12.8 DNS Query Types

Recursive vs Iterative

Query Tools

dig Output Explained


12.9 Common DNS Configurations

Subdomain Setup

Load Balancing with DNS

Geographic DNS

Cloud providers offer geo-based DNS:

12.10 DNS Security

Common Attacks

DNS Spoofing

Attacker returns fake DNS responses, redirecting users to malicious sites.

DNS Cache Poisoning

Corrupting resolver cache to serve wrong IPs.

DNS Amplification DDoS

Using open resolvers to amplify attack traffic.

DNS Tunneling

Encoding data in DNS queries to bypass firewalls.

DNSSEC

DNS Security Extensions add cryptographic signatures to DNS records.

DNS over HTTPS (DoH) / DNS over TLS (DoT)

Traditional DNS is unencrypted (port 53, plaintext). This means anyone between you and the DNS resolver — your ISP, a coffee shop Wi-Fi operator, or a MITM attacker — can see exactly which domains you are querying. It is like asking for directions by shouting across a crowded room — everyone hears where you are trying to go.

What a DNS query looks like at the packet level

Troubleshooting DNS at the packet level: When DNS issues are subtle (intermittent failures, slow resolution), tcpdump or Wireshark are your best friends. Capture DNS traffic with sudo tcpdump -i eth0 port 53 -w dns-capture.pcap. In Wireshark, filter by dns and look for: (1) queries with no response (the resolver or authoritative server might be unreachable), (2) responses with NXDOMAIN status (the domain does not exist — typo in the record?), (3) responses with SERVFAIL (the authoritative server has a configuration problem), or (4) unusually high query times (the resolver is overloaded or the network path is congested).

12.11 Private DNS and Split-Horizon

Private DNS Zones

For internal resources not visible to the public:

Split-Horizon DNS

Same domain returns different results based on where you query from:

12.12 DNS Troubleshooting Checklist


12.13 Key Takeaways

Hierarchy Matters

Root → TLD → Authoritative. Understand the chain.

TTL Controls Caching

Lower before changes, raise after for stability.

Records Have Purposes

A for IPv4, AAAA for IPv6, CNAME for aliases, MX for mail.

Propagation Takes Time

Changes spread globally based on TTL, not instantly.

Next Module

Module 13: Load Balancing & Proxies

Understand how traffic is distributed across servers and how proxies work.