DNS Records — The Building Blocks of DNS¶
DNS Records (also called Resource Records (RRs)) are entries stored in a DNS zone that define how a domain behaves. They map domain names to IP addresses, identify mail servers, specify authoritative name servers, verify domain ownership, and provide configuration information for applications and services. Every website, email service, cloud application, Kubernetes cluster, and enterprise network depends on DNS records. Every Linux administrator, DevOps engineer, Cloud Architect, Platform Engineer, Site Reliability Engineer (SRE), and Network Engineer should understand the most common DNS record types.
Learning Path¶
Course Progress
What You'll Learn¶
After completing this lesson, you'll be able to:
- Understand DNS Records
- Learn the purpose of different record types
- Configure common DNS records
- Understand forward and reverse DNS
- Apply DNS records in enterprise and cloud environments
- Troubleshoot DNS record issues
Prerequisites¶
Complete:
Why Learn DNS Records?¶
Imagine typing:
How does DNS know:
- Website IP Address?
- Mail Server?
- Name Server?
- IPv6 Address?
The answer lies in:
What are DNS Records?¶
DNS Records are entries stored inside a DNS zone.
Example:
Each record has a specific purpose.
Common DNS Records¶
The most common DNS records are:
- A
- AAAA
- CNAME
- MX
- NS
- TXT
- PTR
- SOA
- SRV
A Record¶
A (Address) Record
Maps:
Example:
Example DNS record:
AAAA Record¶
Maps:
Example:
Example record:
CNAME Record¶
Canonical Name Record
Creates an alias.
Example:
Example record:
Instead of creating multiple A records, several hostnames can point to one canonical name.
MX Record¶
Mail Exchange Record
Specifies where email should be delivered.
Example:
Record:
Priority:
Lower preference values indicate higher priority.
NS Record¶
Name Server Record
Identifies the authoritative DNS servers for a domain.
Example:
Example record:
TXT Record¶
Stores arbitrary text information.
Common uses:
- Sender Policy Framework (SPF)
- DomainKeys Identified Mail (DKIM)
- Domain-based Message Authentication, Reporting and Conformance (DMARC)
- Domain Verification
- Cloud Service Validation
Example:
PTR Record¶
Pointer Record
Used for:
Example:
PTR records are stored in reverse lookup zones.
SOA Record¶
Start of Authority Record
Every DNS zone contains exactly one SOA record.
It defines:
- Primary Name Server
- Administrator Email
- Serial Number
- Refresh Timer
- Retry Timer
- Expire Timer
- Minimum Time To Live (TTL)
Example:
SRV Record¶
Service Record
Specifies the location of network services.
Example:
Contains:
- Service
- Protocol
- Priority
- Weight
- Port
- Target
Often used by:
- Microsoft Active Directory
- Session Initiation Protocol (SIP)
- Extensible Messaging and Presence Protocol (XMPP)
- Kubernetes
- Service Discovery
Record Comparison¶
| Record | Purpose |
|---|---|
| A | Hostname → IPv4 |
| AAAA | Hostname → IPv6 |
| CNAME | Alias |
| MX | Mail Server |
| NS | Name Server |
| TXT | Text Information |
| PTR | Reverse Lookup |
| SOA | Zone Information |
| SRV | Service Discovery |
Time To Live (TTL)¶
Every DNS record contains:
Example:
Meaning:
After TTL expires, the resolver requests fresh information.
Forward Lookup¶
Example:
Reverse Lookup¶
Example:
Enterprise Example¶
Company:
Different services use different DNS record types.
Cloud Perspective¶
Cloud providers commonly create DNS records for:
- Load Balancers
- Public IP Addresses
- Private Endpoints
- Storage Accounts
- Kubernetes Ingress
- Content Delivery Network (CDN) Endpoints
Many cloud services automatically manage DNS records during deployment.
Kubernetes Perspective¶
Kubernetes uses DNS extensively.
Examples:
Service discovery relies on DNS records managed by the cluster DNS service.
External DNS controllers can also automatically create:
- A Records
- CNAME Records
for Kubernetes Ingress resources.
Linux Perspective¶
Query A record.
Query AAAA record.
Query MX record.
Query NS record.
Query TXT record.
Reverse lookup.
Alternative tools.
Example DNS Zone¶
Each record contributes different information to the DNS zone.
Advantages of DNS Records¶
- Flexible Name Resolution
- Email Routing
- IPv4 and IPv6 Support
- Service Discovery
- Domain Verification
- Cloud Integration
Limitations¶
- Incorrect records can cause application failures
- DNS changes require propagation time
- Misconfigured MX records can affect email delivery
- Incorrect TTL values can delay updates
Hands-on Lab¶
Task 1¶
Query an A record.
Task 2¶
Query an AAAA record.
Task 3¶
Query MX records.
Task 4¶
Query NS records.
Task 5¶
Query TXT records.
Task 6¶
Perform a reverse lookup.
Task 7¶
Create a table comparing:
- A
- AAAA
- CNAME
- MX
- NS
- TXT
- PTR
- SOA
- SRV
Task 8¶
Design DNS records for:
- Company Website
- Mail Server
- VPN Gateway
- Internal Portal
- Kubernetes Ingress
Linux Commands¶
| Command | Purpose |
|---|---|
dig domain.com | Query A record |
dig AAAA domain.com | Query IPv6 record |
dig MX domain.com | Query mail records |
dig NS domain.com | Query name servers |
dig TXT domain.com | Query TXT records |
dig SRV domain.com | Query SRV records |
dig -x <IP> | Reverse DNS lookup |
host domain.com | Display DNS information |
nslookup domain.com | DNS lookup utility |
Common Mistakes¶
❌ Using a CNAME at the zone apex where unsupported.
✅ Use an A or AAAA record unless your DNS provider supports alias records.
❌ Confusing A and AAAA records.
✅ A is for IPv4; AAAA is for IPv6.
❌ Incorrect MX priorities.
✅ Lower numbers indicate higher priority.
❌ Forgetting to update the SOA serial number on manual DNS servers.
✅ Increment the serial after zone changes.
❌ Setting an excessively long TTL during migrations.
✅ Lower the TTL before planned DNS changes.
Best Practices¶
- Use meaningful hostnames.
- Configure both A and AAAA records where IPv6 is available.
- Keep TTL values appropriate for the environment.
- Protect authoritative DNS zones from unauthorised changes.
- Regularly verify DNS records.
- Document DNS changes and maintain version control for zone files.
Interview Questions¶
Beginner¶
- What is a DNS record?
- What is an A record?
- What is an AAAA record?
- What is a CNAME record?
Intermediate¶
- Explain MX records.
- What is a PTR record?
- What is an SOA record?
- What is TTL?
Architect Level¶
- Design DNS records for a multi-region enterprise application.
- Explain how DNS records support cloud load balancers.
- How would you troubleshoot incorrect DNS record resolution?
Summary¶
In this lesson, you learned:
- DNS Records
- A Records
- AAAA Records
- CNAME Records
- MX Records
- NS Records
- TXT Records
- PTR Records
- SOA Records
- SRV Records
- TTL
- Linux DNS Query Commands
DNS records define how domains, services, and applications are discovered on the Internet and within enterprise networks. From mapping hostnames to IP addresses to directing email and enabling service discovery, DNS records are a critical part of modern networking, cloud infrastructure, and Kubernetes environments.
Key Takeaways¶
- A Records map hostnames to IPv4 addresses.
- AAAA Records map hostnames to IPv6 addresses.
- CNAME Records create aliases.
- MX Records identify mail servers.
- NS Records specify authoritative name servers.
- TXT Records store verification and policy information.
- PTR Records support reverse DNS lookups.
- SOA Records define DNS zone authority and metadata.
- SRV Records enable service discovery.
What's Next?¶
In the next lesson, you'll learn about DNS Resolution.
You'll explore:
- Recursive Resolution
- Iterative Resolution
- DNS Query Process
- DNS Caching
- Root, TLD, and Authoritative Servers
- DNS Response Flow
- Enterprise DNS Architecture
By the end of the lesson, you'll understand the complete journey of a DNS query—from entering a domain name in a browser to receiving the correct IP address from authoritative DNS servers.