Every time you visit a website, something critical happens behind the scenes:
π A domain name is translated into an IP address.
This process is called DNS (Domain Name System) β and understanding it is essential for:
- Hosting servers
- Managing domains
- Running self-hosted apps
πΉ What is DNS?
DNS is like the phonebook of the internet.
Instead of remembering:
142.250.74.78
You use:
google.com
DNS resolves the domain β IP.
πΉ How DNS Works (Step-by-Step)



- You type a domain (e.g.
example.com) - Request goes to a DNS resolver (ISP or public DNS)
- Resolver queries:
- Root servers
- TLD servers (.com)
- Authoritative server
- IP is returned β browser connects
πΉ Common DNS Record Types
A Record
Points domain β IPv4
example.com β 192.168.1.1
AAAA Record
Points domain β IPv6
example.com β 2001:db8::1
CNAME Record
Alias for another domain
www.example.com β example.com
MX Record
Mail servers
example.com β mail.example.com
TXT Record
Used for:
- Verification
- SPF, DKIM (email security)
πΉ Real Example (Cloudflare Setup)
Using Cloudflare DNS:
| Type | Name | Value |
| A | example.com | your-server-ip |
| CNAME | www | example.com |
| A | app | your-server-ip |
πΉ DNS Propagation
After changing DNS:
- It can take seconds β 24 hours
- Depends on TTL (Time To Live)
πΉ Check DNS Records
dig example.com
or
nslookup example.com
πΉ Pro Tips (Advanced)
- Use low TTL while testing (300 seconds)
- Use separate subdomains for services:
app.domain.comapi.domain.com
- Never expose internal services directly
πΉ Common Mistakes
β Wrong IP address
β Missing CNAME for www
β Mixing proxy + direct DNS incorrectly
πΉ Conclusion
Understanding DNS gives you:
- Full control over your infrastructure
- Cleaner architecture
- Better security
π Itβs the foundation of everything in networking.