π Overview of DNS
1. What is DNS?
The Domain Name System (DNS) is often called the phone book of the internet.
It translates human-readable names (like www.google.com) into IP addresses (like 142.250.74.36), which computers actually use to communicate.
Without DNS, you would have to remember IP addresses instead of names β which would be almost impossible in todayβs internet with millions of servers.
2. DNS Basics
- Hostname: A human-readable label (e.g.
server1.mynetwork.local). - Domain: A group of hostnames under a common root (e.g.
mynetwork.local). - IP address: Numerical identifier of a machine (e.g.
192.168.56.10). - Resolver: A program (usually built into the OS) that asks DNS servers for answers.
3. DNS Hierarchy
DNS is hierarchical and structured like a tree:
. (root)
βββ com
β βββ google
β βββ www
βββ org
βββ wikipedia
- Root zone (
.): Top of the hierarchy, delegates to TLDs. - Top-Level Domains (TLDs):
.com,.org,.net, country codes (.de,.uk). - Second-level domains:
google.com,wikipedia.org. - Subdomains / hosts:
www.google.com,mail.google.com.
Each part of the tree is managed by different DNS servers.
4. How a DNS Query Works
Imagine you type www.example.com into your browser:
- Your computer asks its configured DNS server (usually your ISPβs or local DNS).
- If that server doesnβt know, it asks the root servers where to find
.com. - The
.comservers point it to the example.com name servers. - Those servers reply: β
www.example.com=93.184.216.34β. - The answer is returned to your computer, and cached for later use.
This process is usually invisible and happens in milliseconds.
5. Types of DNS Records
DNS stores different resource records in zones. Common ones:
- A record: Maps a hostname β IPv4 address.
Example:www.mynetwork.local β 192.168.56.20 - AAAA record: Maps a hostname β IPv6 address.
- PTR record: Reverse lookup (IP β hostname).
Example:192.168.56.20 β www.mynetwork.local - MX record: Defines mail servers for a domain.
Example:@ β mail.mynetwork.local - NS record: States which server is authoritative for the zone.
- CNAME record: Alias (nickname) for another name.
Example:ftp β www.mynetwork.local.
6. Forward vs Reverse Lookup
- Forward lookup: Name β IP (most common).
Example:ping www.mynetwork.local - Reverse lookup: IP β Name (used for diagnostics, email security).
Example:dig -x 192.168.56.20
Both are equally important in a well-managed network.
7. Static vs Dynamic DNS
- Static DNS: Records are written manually in zone files.
β Good for servers with fixed IPs (web, mail). - Dynamic DNS (DDNS): Records are updated automatically.
β Common with DHCP: when a client gets an IP lease, the DHCP server informs DNS.
8. DNS in a Local Network
In a private network:
- The DNS server (e.g. BIND9) stores custom zones like
mynetwork.local. - Clients use that DNS server to resolve internal names.
- Forward lookups let users connect by name, not IP.
- Reverse lookups ensure IPs map back to the right names.
- With DDNS, DHCP and DNS cooperate to keep records up to date automatically.
9. Why is DNS Important?
- Usability: People remember names, not numbers.
- Scalability: DNS makes the internet manageable.
- Flexibility: IPs can change without affecting users.
- Automation: With DDNS, large networks stay consistent automatically.