DNS Demystified: A Step-by-Step Guide from a DevOps Veteran


🧠 What is DNS (Domain Name System)?

Imagine trying to access a website using an IP like 172.217.3.110 instead of google.com. Nightmare, right?

DNS is like the internet's phonebook. It translates human-readable domain names into machine-readable IP addresses.


🧩 Key Concepts in DNS

Term Description
Domain A human-readable name like example.com
DNS Server Resolves domain names to IPs
Zone A portion of DNS namespace managed by a specific authority
Record An entry in DNS mapping a domain to data like an IP

🧰 Types of DNS Records

Here are the most common ones:

  • A: Maps domain to IPv4 (example.com93.184.216.34)
  • AAAA: Maps domain to IPv6
  • CNAME: Canonical name (alias) mapping
  • MX: Mail exchanger for email routing
  • TXT: Text info, often for verification (e.g., Google, SPF)
  • NS: Name Server records
  • SOA: Start of Authority, defines the zone

🏗️ Step-by-Step DNS Configuration with Examples

Let’s configure DNS for a new domain: coolstartup.io.


1. Buy the Domain

Use a registrar like GoDaddy, Namecheap, or Google Domains.


2. Choose Your DNS Provider

Options include:

  • Cloudflare (Free and fast)
  • Route53 (Powerful AWS-native DNS)
  • Google DNS
  • Registrar’s default DNS

For this demo, we’ll use Cloudflare.


3. Set Nameservers at Registrar

After adding your domain to Cloudflare, you’ll receive nameservers like:

ns1.cloudflare.com
ns2.cloudflare.com

Go to your registrar dashboard and replace the default nameservers with the above.


4. Add DNS Records in Cloudflare

👉 Add an A Record

Type Name Value TTL
A @ 203.0.113.10 Auto

@ means root domain (coolstartup.io)

👉 Add a CNAME for www

Type Name Value TTL
CNAME www coolstartup.io Auto

5. Test DNS Propagation

Use:

nslookup coolstartup.io
dig coolstartup.io

or online tools:


6. Add a TXT Record for Domain Verification

For Google Search Console:

Type Name Value
TXT @ google-site-verification=abc123xyz

⚠️ Common Pitfalls to Avoid

  • DNS Propagation Delay: Can take up to 48 hours globally
  • No TTL Planning: Use lower TTLs for frequent updates
  • Misconfigured CNAMEs: You can’t have CNAME at root level with some providers

🧪 Real-World Example: Deploying a Web App on AWS with Custom Domain

  1. Launch EC2 and get public IP
  2. Set A record in DNS to EC2 IP
  3. Add HTTPS with Let’s Encrypt via Certbot
  4. Boom 💥—your app is live with a friendly domain!

📘 Resources to Deepen Your DNS Mastery


🚀 Final Thoughts

DNS is simple but powerful. Whether you're deploying apps, setting up email, or managing APIs — understanding DNS is non-negotiable.


🔥 Once you master DNS, you stop fearing domains. You start owning them.

Happy configuring, engineer! 👨‍💻