Complete Guide to Domain Name System (DNS)
Table of Contents
Introduction to DNS
The Domain Name System (DNS) is a fundamental component of the internet that translates human-friendly domain names into machine-readable IP addresses. It functions as a distributed directory service that maintains a mapping between hostnames and their numerical addresses.
How DNS Works
When you enter a domain name in your browser (e.g., www.example.com), a DNS client (resolver) sends a request to a DNS server to find the corresponding IP address. The DNS server either provides the answer directly or queries other servers to find the information.
DNS is essential because while humans find names easier to remember, network devices require IP addresses to route traffic. This system bridges the gap between human convenience and network requirements.
Name Space Organization
DNS organizes names in a structured way to ensure uniqueness and efficient resolution. There are two primary approaches to organizing name spaces:
1. Flat Name Space
In a flat name space:
- Names are assigned to addresses without any hierarchical structure
- Each name is a sequence of characters without inherent meaning
- Requires centralized control to prevent duplication
Flat name spaces are impractical for large systems like the Internet due to the need for centralized control and the difficulty of maintaining uniqueness at scale.
2. Hierarchical Name Space
In a hierarchical name space:
- Names are composed of multiple parts with specific meanings
- Authority can be decentralized (e.g., different organizations manage different parts)
- Enables scalability for large networks like the Internet
The hierarchical approach is what DNS uses, with names like mail.google.com where:
comis the top-level domain (TLD)googleis the second-level domainmailis the subdomain or hostname
Domain Name Space
The DNS hierarchical name space is structured as an inverted tree with up to 128 levels (0-127), where level 0 is the root.
[Diagram of DNS tree structure would appear here]
Key Components
Labels
Each node in the tree has a label:
- Maximum of 63 characters
- Root label is empty (null string)
- Siblings must have unique labels
Domain Names
A domain name is the sequence of labels from a node to the root, separated by dots:
- Read from left (specific) to right (general)
- Technically ends with a null label (implied dot)
- Example:
mail.google.com.(the trailing dot represents the root)
Fully Qualified vs. Partially Qualified
| Type | Description | Example |
|---|---|---|
| FQDN (Fully Qualified Domain Name) | Complete name ending with root (dot) | mail.google.com. |
| PQDN (Partially Qualified Domain Name) | Incomplete name, resolver adds suffix | mail (resolver might add .google.com) |
Domains
A domain is a subtree of the name space:
- Can be divided into subdomains
- Example:
google.comis a domain that contains subdomains likemail.google.com
Distribution of Name Space
The DNS information is distributed across many servers worldwide for efficiency and reliability.
Hierarchy of Name Servers
The DNS hierarchy is mirrored by a hierarchy of servers:
- Root servers (top of hierarchy)
- Top-level domain (TLD) servers (e.g.,
.com,.org) - Authoritative servers (for specific domains)
Zones
A zone is a contiguous portion of the domain name space that a server is responsible for:
- May be an entire domain or part of one
- Each zone has a
zone filecontaining its information
Server Types
| Server Type | Description |
|---|---|
| Root Server | Knows about TLD servers, delegates authority |
| Primary Server | Maintains and updates zone files |
| Secondary Server | Gets zone data from primary servers for redundancy |
DNS in the Internet
The Internet's domain name space is divided into three main sections:
1. Generic Domains
Define registered hosts by their generic behavior:
| Label | Purpose |
|---|---|
.com |
Commercial organizations |
.edu |
Educational institutions |
.gov |
Government agencies |
.org |
Non-profit organizations |
.net |
Network infrastructure |
2. Country Domains
Use two-letter country codes (e.g., .us, .uk) with possible subdivisions:
- Example:
anza.cup.ca.us→ De Anza College in Cupertino, California, USA
3. Inverse Domain
Used for reverse DNS lookups (IP address to name):
- First-level node:
arpa - Second-level node:
in-addr - IP addresses are reversed (e.g., 132.34.45.121 becomes
121.45.34.132.in-addr.arpa)
Name-Address Resolution
The process of mapping names to addresses (or vice versa) is called resolution.
Resolver
The DNS client that initiates queries is called a resolver.
Resolution Methods
1. Recursive Resolution
- Resolver asks for complete answer
- Server handles all intermediate queries
- Returns final answer to resolver
2. Iterative Resolution
- Server returns best answer it can
- May refer resolver to other servers
- Resolver must contact referred servers
[Diagram comparing recursive and iterative resolution would appear here]
DNS Messages
DNS uses two message types with identical formats:
| Message Type | Contents |
|---|---|
| Query | Header + Question section |
| Response | Header + Question + Answer + Authority + Additional sections |
Header Format
12-byte header containing:
- Identification (matches queries with responses)
- Flags (message type, desired resolution type, etc.)
- Counts for each section
Message Sections
| Section | Purpose |
|---|---|
| Question | Contains the query (present in both message types) |
| Answer | Response records (only in response messages) |
| Authority | Information about authoritative servers (response only) |
| Additional | Extra information that might help resolver (response only) |
DNS Records
DNS uses two main record types:
1. Question Records
Used in the Question section to specify the query.
2. Resource Records
Contain the actual DNS data in responses. Types include:
| Record Type | Purpose |
|---|---|
| A | IPv4 address |
| AAAA | IPv6 address |
| CNAME | Canonical name (alias) |
| MX | Mail exchange |
| NS | Name server |
| PTR | Pointer (for reverse DNS) |
| SOA | Start of authority |
| TXT | Text information |
Domain Registration
New domains are added through accredited registrars:
Registration Process
- Registrar verifies domain name uniqueness
- Enters domain into DNS database
- Requires server name and IP address
Example Registration
To register ws.wonderful.com:
- Domain name:
ws.wonderful.com - IP address:
200.200.200.5
ICANN Accreditation
Registrars must be accredited by the Internet Corporation for Assigned Names and Numbers (ICANN). A list of accredited registrars can be found at www.intenic.net.
Key Takeaways
- DNS translates domain names to IP addresses and vice versa
- Uses a hierarchical name space for scalability
- Distributed across servers worldwide for reliability
- Supports both forward (name→IP) and reverse (IP→name) lookups
- New domains are registered through ICANN-accredited registrars
0 Comments