DNS (Domain Name System) maps human-readable domain names to IP addresses. It's a hierarchical, distributed database — no single server holds all the answers.
.com (130M+ domains, $1B+ ARR).When you register example.com: registrar → notifies Verisign → Verisign adds an NS record to the .com zone → root zone delegates .com to Verisign → your domain becomes resolvable.
Root (.)
└── TLD (.com, .org, .io)
└── Domain (google.com)
└── Subdomain (mail.google.com)
.com). They know which nameservers are authoritative for each domain.When you query mail.google.com:
8.8.8.8.com TLD nameservers.com TLD → gets Google's authoritative nameserversmail.google.comRecursive resolvers do the legwork on your behalf. Authoritative servers answer with actual records — no forwarding.
Every DNS record has a TTL (Time to Live) in seconds. Resolvers cache results until TTL expires, then re-query. Lower TTL before a migration for faster propagation; higher TTL reduces load on nameservers.
| Record | Purpose |
|---|---|
| A | Domain → IPv4 address |
| AAAA | Domain → IPv6 address |
| CNAME | Alias from one name to another |
| MX | Mail server for the domain (with priority) |
| TXT | Arbitrary text — SPF, DKIM, domain verification |
| NS | Authoritative nameservers for the domain |
| PTR | Reverse lookup: IP → domain name |
| SOA | Zone metadata — primary NS, admin email, serial, refresh intervals |
| SRV | Service location — host, port, priority, weight |
| CAA | Which CAs are allowed to issue certs for the domain |
Standard queries use UDP port 53 — fast, low overhead. TCP port 53 is used for: - Responses larger than 512 bytes (common with DNSSEC) - Zone transfers (AXFR) between nameservers
Adds cryptographic signatures to DNS records so resolvers can verify a record actually came from the legitimate zone owner.
Prevents cache poisoning but doesn't encrypt queries — that's DNS over HTTPS/TLS.
Standard DNS is plaintext. Anyone on the path (ISP, router) can see every domain you query.
Both encrypt the query. The destination IP is still visible.
Cache poisoning — inject a forged record into a resolver's cache so victims get directed to an attacker-controlled IP. DNSSEC prevents it; randomized source ports and bailiwick rules reduce exposure.
DNS hijacking — compromise a registrar account or nameserver to change authoritative records. Registry locks and 2FA on registrar accounts help.
DNS amplification — send spoofed queries with the victim's IP as source. Resolver sends large responses to the victim. Used in DDoS.
DNS tunneling — encode data inside DNS queries and responses to exfiltrate data or tunnel C2 traffic through firewalls that allow DNS.
dig google.com # basic A record lookup
dig google.com MX # query specific record type
dig @8.8.8.8 google.com # query a specific resolver
dig +trace google.com # follow the full resolution chain
dig -x 8.8.8.8 # reverse lookup (PTR)
nslookup google.com # simpler alternative to dig
whois google.com # registrar and registration info