The Domain Name System (DNS) is one of the foundational protocols that keep the internet functioning. It is routinely described as the “phonebook of the internet,” translating human-friendly hostnames like flovo.in into machine-routable IP addresses like 104.21.45.190 or 2606:4700:3033::6815:2dbe.

While the concept sounds simple, DNS is a globally distributed, hierarchical, eventually consistent database with complex caching behavior. Misconfigured DNS records cause subtle outages, broken email delivery, failed SSL certificate issuances, and extended downtime during domain migrations.

In this guide, we break down how DNS resolution actually operates under the hood, examine the essential record types every engineer must understand, explain the truth about DNS propagation, and demonstrate how to debug resolution issues using command-line diagnostic tools.


The Hierarchy of a Domain Name

Every domain name is structured in a tree hierarchy read from right to left, terminating at an implicit root zone denoted by a dot (.):

       . (Root Zone)
       |
     +---+---+
     |       |
    .in     .com (Top-Level Domains / TLDs)
     |
  flovo.in (Second-Level Domain / Apex / Naked Domain)
     |
   blog.flovo.in (Subdomain)
  1. Root Zone (.): Managed by the Internet Assigned Numbers Authority (IANA) and coordinated by ICANN. Thirteen logical root server clusters (named a.root-servers.net through m.root-servers.net), distributed across hundreds of physical locations worldwide via Anycast, direct queries to TLD registries.
  2. Top-Level Domain (TLD): The segment immediately following the final dot (e.g., .in, .com, .org, .tech). TLD registries maintain authoritative nameservers for their respective extensions (such as the National Internet Exchange of India for .in, or VeriSign for .com).
  3. Second-Level Domain (Apex / Root Domain): The unique domain registered by an entity (e.g., flovo.in). Also referred to as the “apex domain” or “naked domain”.
  4. Subdomain: A prefix under your domain space (e.g., blog.flovo.in, api.flovo.in, app.flovo.in) that can be routed to independent infrastructure.

The DNS Resolution Lifecycle

When a user types a URL into their browser, the system executes a recursive resolution query if the answer is not already stored in local cache.

+-----------------------------------------------------------------------------------+
|                            DNS Resolution Flow                                    |
+-----------------------------------------------------------------------------------+
|                                                                                   |
|  [Browser / OS Client]                                                            |
|          |                                                                        |
|          | 1. Query: "What is the IP of blog.flovo.in?"                           |
|          v                                                                        |
|  [Recursive Resolver] (e.g., 1.1.1.1, 8.8.8.8, ISP)                              |
|          |                                                                        |
|          +--- 2. "Who handles .in?" --------------------> [Root Nameserver]       |
|          |<-- 3. "Go ask TLD nameserver ns1.registry.in" -+                       |
|          |                                                                        |
|          +--- 4. "Who handles flovo.in?" ---------------> [TLD Nameserver]        |
|          |<-- 5. "Go ask Authoritative NS ns1.cloudflare" +                       |
|          |                                                                        |
|          +--- 6. "What is the IP of blog.flovo.in?" ----> [Authoritative NS]      |
|          |<-- 7. "Answer: 104.21.45.190 (TTL: 300)" ------+                       |
|          |                                                                        |
|          | 8. Returns IP to Client (and caches locally for TTL duration)          |
|          v                                                                        |
|  [Browser initiates TCP/TLS handshake with 104.21.45.190]                         |
+-----------------------------------------------------------------------------------+

Key Components

  • DNS Client / Stub Resolver: The operating system library (e.g. getaddrinfo on Linux/POSIX) that applications invoke to resolve names.
  • Recursive Resolver: The server (operated by your ISP, or public providers like Cloudflare 1.1.1.1 or Google 8.8.8.8) that does the heavy lifting of traversing the DNS tree on your behalf.
  • Authoritative Nameserver: The server that actually holds the definitive DNS records for a specific domain zone (e.g., Cloudflare DNS, AWS Route 53, or DigitalOcean DNS).

Critical DNS Record Types Explained

Each DNS record has a specific purpose, format, and behavior:

1. A Record (Address Record)

Maps a hostname to an IPv4 address (32-bit).

# Name               Type  TTL   Target
flovo.in.            A     300   192.0.2.1

2. AAAA Record (IPv6 Address Record)

Maps a hostname to an IPv6 address (128-bit). Modern networks prioritize AAAA over A when IPv6 routing is available (Happy Eyeballs algorithm).

# Name               Type  TTL   Target
flovo.in.            AAAA  300   2001:db8::8a2e:370:7334

3. CNAME Record (Canonical Name)

Creates an alias from one domain name to another canonical domain name. It points to a name, never directly to an IP address.

# Name               Type   TTL   Target
blog.flovo.in.       CNAME  300   flovo-blog.pages.dev.

The Apex Domain Limitation: According to RFC 1912 (Section 2.4), a CNAME record cannot coexist with any other record type for the same name. Because a domain’s apex (flovo.in) requires NS and SOA records, you cannot put a traditional CNAME on the apex. Modern DNS providers bypass this using CNAME Flattening or ALIAS/ANAME records, which resolve the target hostname to IP addresses dynamically at query time and return standard A/AAAA responses.

4. MX Record (Mail Exchange)

Specifies the mail servers responsible for receiving email for your domain, accompanied by an integer priority weight (lower numbers indicate higher priority).

# Name        Type  Priority  TTL   Target
flovo.in.     MX    10        3600  aspmx.l.google.com.
flovo.in.     MX    20        3600  alt1.aspmx.l.google.com.

5. TXT Record (Text)

Carries arbitrary human- or machine-readable text data. Primarily used for domain ownership verification and email security protocols:

  • SPF (Sender Policy Framework): Declares authorized outgoing email servers:
    flovo.in.  TXT  3600  "v=spf1 include:_spf.google.com ~all"
    
  • DKIM (DomainKeys Identified Mail): Holds the public cryptographic key used to verify digital signatures on outgoing emails:
    google._domainkey.flovo.in.  TXT  3600  "v=DKIM1; k=rsa; p=MIGfMA0GCS..."
    
  • DMARC (Domain-based Message Authentication): Dictates how receivers should treat emails failing SPF or DKIM checks:
    _dmarc.flovo.in.  TXT  3600  "v=DMARC1; p=reject; rua=mailto:[email protected]"
    

6. NS Record (Name Server)

Delegates a DNS zone to specific authoritative nameservers. When you purchase a domain at a registrar and host DNS on Cloudflare, you update the registrar’s NS records:

flovo.in.  NS  86400  ns1.cloudflare.com.
flovo.in.  NS  86400  ns2.cloudflare.com.

7. CAA Record (Certification Authority Authorization)

Specifies which Certificate Authorities (CAs) are legally allowed to issue SSL/TLS certificates for your domain. This prevents rogue or compromised CAs from issuing fraudulent certificates.

flovo.in.  CAA  3600  0 issue "letsencrypt.org"
flovo.in.  CAA  3600  0 issue "pki.goog"
flovo.in.  CAA  3600  0 iodef "mailto:[email protected]"

TTL and the Truth About “DNS Propagation”

When developers update a DNS record, they are often warned: “Please allow 24 to 48 hours for DNS propagation.”

In reality, DNS updates take effect based strictly on Time-To-Live (TTL) values and resolver cache compliance:

  • TTL (in seconds) is an explicit instruction from the authoritative nameserver telling resolvers how long they are permitted to cache a record before querying again.
  • If your record’s TTL is set to 300 (5 minutes), resolvers worldwide will purge their cached record within 300 seconds of having fetched it.
  • If your TTL was set to 86400 (24 hours), any resolver that queried your site 1 minute before your change will serve the old IP for the remaining 23 hours and 59 minutes.
Old Record Active (TTL: 86400)
       |
       |  1. Lower TTL to 300 (48 hours BEFORE migration)
       v
Transitional State (TTL: 300)
       |
       |  2. Execute DNS cutover to new IP/target
       v
Instant Global Switchover (Takes at most 300 seconds)
       |
       |  3. Restore TTL to 3600 or 86400 once verified
       v
Stable Production State

Zero-Downtime Migration Playbook

  1. 48 hours prior to server migration: Lower the TTL of all target records to 300 seconds.
  2. During migration: Update the record to point to the new IP/target. Global resolution switches over in under 5 minutes.
  3. 24 hours post-migration: Verify traffic and stability, then restore TTL to a standard value (e.g., 3600 or 14400) to reduce resolver query overhead.

Hands-On Debugging with dig

dig (Domain Information Groper) is the gold standard CLI utility for DNS troubleshooting. It is part of the bind9-dnsutils package on Debian/Ubuntu and macOS.

1. Basic Query

Retrieve the A records for a domain:

dig flovo.in +noall +answer

Output:

flovo.in.		300	IN	A	104.21.45.190
flovo.in.		300	IN	A	172.67.182.20

2. Querying a Specific Nameserver

Bypass your local or ISP cache by querying an authoritative nameserver directly:

# Query Cloudflare public DNS
dig @1.1.1.1 flovo.in A +short

# Query Google public DNS
dig @8.8.8.8 flovo.in A +short

# Query the authoritative nameserver directly
dig @ns1.cloudflare.com flovo.in A +short

If the authoritative server returns the new IP but @1.1.1.1 returns the old IP, the change has saved successfully at the source and the public resolvers are waiting for the previous TTL to expire.

3. Tracing the Full Resolution Chain (+trace)

See every step from root servers down to the authoritative answer:

dig flovo.in +trace

This reveals whether delegation broken at the root, TLD, or authoritative tier.

4. Querying MX and TXT Records

# Inspect Mail Records
dig flovo.in MX +short

# Inspect SPF / DKIM verification strings
dig flovo.in TXT +short

Flovo Production DNS Best Practices

  1. Always Set CAA Records: Explicitly declare your SSL issuers (e.g., letsencrypt.org, digicert.com) to prevent unauthorized certificate issuance.
  2. Utilize CNAME Flattening for Apex Domains: Avoid static A records pointing directly to edge IP pools that can change without notice.
  3. Lock Registrar Accounts: Protect against domain hijacking with Registrar Lock, multi-factor hardware authentication, and registry-level transfer blocks.
  4. Enforce Email Authentication: Never operate a production domain without valid SPF, DKIM, and DMARC records to protect your domain reputation.
  5. Monitor DNS Health: Use automated uptime probes querying external recursive resolvers globally to catch resolution failures before customers do.