Getting to Know DNS: What It Is and How It Works
A complete explanation of DNS (Domain Name System), from the basic concepts to the behind-the-scenes process of how domain names resolve to IP addresses.
What is DNS?
DNS, or the Domain Name System, is the system that translates domain names (like google.com) into IP addresses (like 142.250.80.46). Without DNS, we would have to memorize the IP address of every website we want to visit.
A Simple Analogy
Think of DNS as the internet’s phone book:
- Domain name = A person’s name
- IP address = A phone number
When you type “google.com” into your browser, DNS looks up the matching IP address, and then the browser contacts the server at that address.
How DNS Works
Here are the steps that happen when you access a website:
- Browser Check - The browser checks its local cache
- OS Cache - If nothing is there, the OS checks its cache
- Router Cache - The router also has a DNS cache
- ISP DNS - The query is sent to the ISP’s DNS server
- Root DNS - If it is not found, the query goes to a root server
- TLD Server - The root server points to the TLD server (.com, .id, etc.)
- Authoritative DNS - The TLD server points to the domain’s DNS server
- Response - The IP address is returned to the browser
Browser → OS → Router → ISP DNS → Root → TLD → Authoritative → IP Address
DNS Records
| Record | Function | Example |
|---|---|---|
| A | Domain to IPv4 | example.com → 93.184.216.34 |
| AAAA | Domain to IPv6 | example.com → 2606:2800:220:1::248 |
| CNAME | Domain alias | www → example.com |
| MX | Mail server | example.com → mail.example.com |
| TXT | Informational text | Domain verification, SPF, DKIM |
| NS | DNS server | Domain → ns1.example.com |
Self-Hosted DNS with Pi-hole
In a homelab, you can run Pi-hole as a DNS server:
# Install Pi-hole in Docker
docker run -d \
--name pihole \
-p 53:53/tcp \
-p 53:53/udp \
-p 80:80 \
-e TZ=Asia/Jakarta \
pihole/pihole:latest
Pi-hole features:
- Ad-blocking - Block ads across the entire network
- DNS over HTTPS - Encrypt DNS queries
- Query logging - Monitor DNS activity
- Custom rules - Create your own blocking rules
DNS Security Tips
- Use DNS over HTTPS (DoH) or DNS over TLS (DoT)
- Consider self-hosted DNS for more privacy
- Use DNS filtering to block malware
- Back up your DNS configuration
Conclusion
DNS is the foundation of the internet that is often overlooked. By understanding DNS, you can:
- Troubleshoot network problems
- Improve security and privacy
- Optimize browsing performance
- Build a better homelab infrastructure
Related Articles
RT/RW Net: The Community Internet That Transformed a Nation
An introduction to RT/RW Net, the community internet network born from Indonesian residents' creativity, covering its history, workings, and impact on the digital divide.
NetworkingHomelab Network Topology: From Zero to Advanced Network
A complete guide to building a homelab network topology from scratch, from basic setup to VLANs, MikroTik, and RT/RW Net.
NetworkingNetwork Traffic Analysis with Wireshark for Beginners
Learn to read network traffic with Wireshark: capturing packets, understanding the three-way handshake, spotting suspicious protocols, and knowing what triggers an alert.
Your ideas deserve to be read by thousands of people.
ByteNesia is built for everyone. If you have experience, tutorials, or opinions about technology, write and share them here. Your name will be credited as a contributor.
Write anything: tool reviews, homelab tutorials, security tips, or your tech stories.