DNS (Domain Name System) is a hierarchical, distributed naming system used to resolve human-readable domain names into machine-readable IP addresses. It acts as the directory infrastructure of the internet, translating hostnames like example.com into numeric identifiers such as 93.184.216.34 (IPv4) or 2606:2800:220:1:248:1893:25c8:1946 (IPv6). This translation allows applications and browsers to locate and route traffic to the correct servers without users having to memorize raw network addresses.
How it works
When an uncached domain is requested, the client sends a query to a recursive resolver—typically operated by an ISP or a public provider. If the resolver does not hold the answer in memory, it performs an iterative lookup across a strict hierarchy of servers:
- Root nameservers: Direct the resolver to the appropriate Top-Level Domain (TLD) server based on the domain extension (such as
.comor.org). - TLD nameservers: Point the resolver to the specific authoritative nameservers responsible for that individual domain.
- Authoritative nameservers: Return the final resource record containing the target IP address or routing rule.
To prevent repeated lookups and reduce latency, resolvers and operating systems cache answers locally for a duration defined by each record's TTL (Time to Live) value. At the transport layer, DNS primarily uses UDP port 53 for fast, single-packet queries, falling back to TCP port 53 when response payloads exceed 512 bytes (without EDNS0 extensions) or during full zone transfers (AXFR).
Example
Administrators define domain behavior using resource records inside a zone file. Common record types include A (IPv4 address), AAAA (IPv6 address), CNAME (domain alias), MX (mail routing), and TXT (arbitrary text for verification and email authentication).
; Example zone records for example.com
@ 300 IN A 93.184.216.34
@ 300 IN AAAA 2606:2800:220:1:248:1893:25c8:1946
www 300 IN CNAME example.com.
@ 3600 IN MX 10 mail.example.com.
@ 3600 IN TXT "v=spf1 include:_spf.example.com -all"
You can query these live records directly from a terminal using dig:
dig +short example.com A
What matters when choosing a server or hosting
- Anycast network routing: Authoritative DNS providers using Anycast announce the same IP address from multiple global locations, routing user queries to the nearest edge node for lower lookup latency and built-in DDoS resilience.
- DNSSEC support: Domain Name System Security Extensions cryptographically sign DNS records, protecting visitors against cache poisoning and man-in-the-middle spoofing.
- API and Infrastructure-as-Code access: For automated DevOps pipelines, choose a provider offering a reliable REST API and native Terraform support so DNS changes can be version-controlled alongside application deployments.
- Granular TTL controls: Ensure your provider allows low minimum TTLs (such as 60 seconds) so you can execute rapid failover or server migrations without waiting hours for stale caches to expire.
Common mistakes
- Forgetting to lower TTLs before migrations: Leaving a 24-hour TTL active prior to moving servers forces clients to hit the old IP address until cached entries expire.
- Placing a CNAME at the zone apex: Standard DNS specifications prohibit
CNAMErecords at the root domain (example.com) because they conflict with mandatorySOAandNSrecords; use anArecord or provider-specificALIAS/ANAMEflattening instead. - Omitting trailing dots in zone files: Writing
mail.example.comwithout a trailing period inside a zone file causes the server to append the origin domain, resulting in a brokenmail.example.com.example.comtarget.
FAQ
What is the difference between a recursive resolver and an authoritative nameserver?
A recursive resolver acts as a middleman that queries other servers on behalf of a client and caches the results. An authoritative nameserver holds the actual source-of-truth zone records for a domain and provides the final answers.
Why do DNS changes take time to appear globally?
DNS does not push updates; resolvers cache previous answers until the record's TTL timer runs out. Global visibility depends on how long downstream ISPs and client devices continue serving their cached copies.
Can I host my DNS separately from my web server?
Yes. Delegating your domain's NS records to a dedicated DNS provider is standard practice, separating routing management from compute infrastructure and preventing DNS downtime if your web server fails.