DEV Community

Cover image for Networking 101 #4. DNS Explained
Himanshu Bhatt
Himanshu Bhatt

Posted on

Networking 101 #4. DNS Explained

πŸ‘‹ Short Intro (Why I’m Writing This)

I’m currently learning Networking for DevOps and decided to learn in public by documenting my journey.

This blog is part of my Networking 101 series, where I’m learning Networking for DevOps step by step from scratch.

This series is not written by an expert β€” it’s a beginner learning out loud, sharing:

  • what I understand,
  • what confuses me,
  • and what I learn along the way.

The goal is to build consistency, clarity, and invite discussion.


πŸ“Œ What This Blog Covers

In this post, I’ll cover:

  • What is DNS?
  • DNS Resolution flow
  • DNS Caching
  • TTL in DNS caching
  • Common DNS Record types

πŸ“‚ GitHub Repository

All my notes, diagrams, and learning resources for this series live here:

πŸ‘‰ GitHub Repo:

https://github.com/dmz-v-x/networking-for-devops-101

This repo is updated as I continue learning.


πŸ“š Learning Notes

1. Quick recap (from earlier blogs)

From Part 1:

Computers do NOT understand domain names.

They only understand IP addresses.

DNS exists to translate:

myapp.com β†’ 13.234.56.78
Enter fullscreen mode Exit fullscreen mode

DNS happens before:

  • TCP connection
  • HTTPS
  • Any application logic

If DNS fails, nothing else matters.


2. What actually happens during DNS resolution

When your browser wants to reach:

https://myapp.com
Enter fullscreen mode Exit fullscreen mode

It asks:

β€œWhat IP address belongs to myapp.com?”

But who does it ask?


3. DNS resolution flow (simplified)

Browser
  ↓
OS DNS Cache
  ↓
Local Resolver (ISP / 8.8.8.8 / 1.1.1.1)
  ↓
Authoritative DNS Server
  ↓
IP Address returned
Enter fullscreen mode Exit fullscreen mode

DNS is distributed, not centralized.

This design makes DNS:

  • Fast
  • Scalable
  • Cache-heavy (important!)

4. What is DNS caching?

To avoid repeating DNS lookups:

  • Browsers cache results
  • OS caches results
  • DNS resolvers cache results

Each cached record has a TTL.


5. TTL β€” Time To Live

TTL tells DNS:

β€œHow long can I remember this answer?”

Example:

TTL = 300 seconds (5 minutes)
Enter fullscreen mode Exit fullscreen mode

Meaning:

  • DNS answer can be reused for 5 minutes
  • No fresh lookup needed during this time

6. Real DevOps DNS failure example

Scenario:

  • You update your server IP
  • You update DNS record
  • Some users still hit the old server

Why?

  • Old IP is cached
  • TTL hasn’t expired yet

DNS is eventually consistent, not instant.


7. Common DNS record types (DevOps must-know)

You do NOT need to know all DNS records.

These are enough.

7.1 A Record

Maps a domain to an IP address.

myapp.com β†’ 13.234.56.78
Enter fullscreen mode Exit fullscreen mode

7.2 CNAME Record

Maps one domain to another domain.

www.myapp.com β†’ myapp.com
Enter fullscreen mode Exit fullscreen mode

Used for:

  • Aliases
  • Load balancers
  • Cloud services

7.3 TXT Record

Stores arbitrary text.

Used for:

  • Domain verification
  • SSL certificates
  • Email security

Used often when working with cloud providers.


8. Why CNAMEs matter in DevOps

CNAMEs allow:

  • Changing infrastructure without changing domains
  • Blue/green deployments
  • Easier migrations

Example:

app.mycompany.com β†’ alb-123.aws.com
Enter fullscreen mode Exit fullscreen mode

You update the load balancer β€” DNS stays same.


9. Common DNS debugging commands

9.1 Check DNS resolution

dig myapp.com
Enter fullscreen mode Exit fullscreen mode

9.2 Use a specific DNS server

dig myapp.com @8.8.8.8
Enter fullscreen mode Exit fullscreen mode

9.3 See only the IP

dig myapp.com +short
Enter fullscreen mode Exit fullscreen mode

9.4 Using nslookup

nslookup myapp.com
Enter fullscreen mode Exit fullscreen mode

10. Why DNS works for some users and not others

Because:

  • Different users use different DNS resolvers
  • Different caches expire at different times
  • ISPs cache aggressively

This is normal DNS behavior, not a bug.


11. DNS vs TCP vs HTTP (clear separation)

Layer Failure Example
DNS Domain not resolving
TCP Connection refused
TLS Certificate error
HTTP 500 error
App Logic bug

Always identify which layer is failing.


12. Classic DevOps mistake

Mistake:

β€œDNS change didn’t work β€” let’s restart the server.”

Wrong.

DNS:

  • Lives outside your server
  • Is cached everywhere
  • Needs time to propagate

Restarting apps won’t fix DNS.


13. Mini hands-on exercise

Run:

dig google.com
Enter fullscreen mode Exit fullscreen mode

Look at:

  • ANSWER section
  • TTL value

Run it again:

  • Notice TTL decreases

That’s caching in action.


14. Mental model upgrade

Your updated flow:

Browser
  ↓
DNS (cached or fresh)
  ↓
IP + Port
  ↓
TCP / UDP
  ↓
Application
Enter fullscreen mode Exit fullscreen mode

DNS is always first.


βœ… Key takeaways

  • DNS converts names β†’ IPs
  • DNS is cached everywhere
  • TTL controls how long results live
  • DNS issues look random but are predictable
  • Debug DNS before touching servers

πŸ’¬ Feedback & Discussion

πŸ’‘ I’d love your feedback!

If you notice:

  • missing tool categories,
  • incorrect assumptions,
  • or better learning paths,

please comment below. I’m here to learn.


⭐ Support the Learning Journey

If you found this blog useful:

⭐ Consider giving the GitHub repo a star β€”

it really motivates me to keep learning and sharing publicly.


🐦 Stay Updated (Twitter / X)

I share learning updates, notes, and progress regularly.

πŸ‘‰ Follow me on Twitter/X:

https://x.com/_himanshubhatt1


πŸ”œ What’s Next

In the next post, I’ll be covering:

πŸ‘‰ Subnets, CIDR & NAT

I’ll also continue updating the GitHub repo as I progress.


πŸ“˜ Learning in public

πŸ“‚ Repo: https://github.com/dmz-v-x/networking-for-devops-101
🐦 Twitter/X: https://x.com/_himanshubhatt1
πŸ’¬ Feedback welcome β€” please comment if anything feels off
⭐ Star the repo if you find it useful

Top comments (0)