Skip to content

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

Networking Mastery → Module 6: DNS & DHCP → Lesson 2

Difficulty: Beginner

Reading Time: 100 Minutes

Course Progress

Course: Networking Mastery

Module: DNS & DHCP

Lesson: 2 of 7


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:

www.rebash.in

How does DNS know:

  • Website IP Address?
  • Mail Server?
  • Name Server?
  • IPv6 Address?

The answer lies in:

DNS Records

What are DNS Records?

DNS Records are entries stored inside a DNS zone.

Example:

google.com


A Record


142.250.x.x

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:

Hostname


IPv4 Address

Example:

www.example.com


192.168.10.20

Example DNS record:

www    IN    A      192.168.10.20

AAAA Record

Maps:

Hostname


IPv6 Address

Example:

www.example.com


2001:db8::20

Example record:

www    IN    AAAA   2001:db8::20

CNAME Record

Canonical Name Record

Creates an alias.

Example:

blog.example.com


www.example.com

Example record:

blog    IN    CNAME    www.example.com.

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:

example.com


mail.example.com

Record:

example.com.    IN    MX    10 mail.example.com.

Priority:

10


Higher Priority

Lower preference values indicate higher priority.


NS Record

Name Server Record

Identifies the authoritative DNS servers for a domain.

Example:

example.com


ns1.example.com


ns2.example.com

Example record:

example.com.    IN    NS    ns1.example.com.

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:

example.com.


TXT


"v=spf1 include:_spf.google.com ~all"

PTR Record

Pointer Record

Used for:

Reverse DNS

IP Address


Hostname

Example:

8.8.8.8


dns.google

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:

example.com.


SOA

SRV Record

Service Record

Specifies the location of network services.

Example:

_sip._tcp.example.com

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:

TTL

(Time To Live)

Example:

3600 Seconds

Meaning:

Cache

1 Hour

After TTL expires, the resolver requests fresh information.


Forward Lookup

Example:

example.com


A Record


192.168.10.10

Reverse Lookup

Example:

192.168.10.10


PTR Record


example.com

Enterprise Example

Company:

portal.company.com


A Record
mail.company.com


MX Record
vpn.company.com


A Record
teams.company.com


CNAME

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:

frontend.default.svc.cluster.local

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.

dig google.com

Query AAAA record.

dig AAAA google.com

Query MX record.

dig MX gmail.com

Query NS record.

dig NS example.com

Query TXT record.

dig TXT example.com

Reverse lookup.

dig -x 8.8.8.8

Alternative tools.

host google.com
nslookup google.com

Example DNS Zone

example.com.


SOA


NS


A


AAAA


MX


TXT


CNAME


SRV

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.

dig google.com

Task 2

Query an AAAA record.

dig AAAA google.com

Task 3

Query MX records.

dig MX gmail.com

Task 4

Query NS records.

dig NS google.com

Task 5

Query TXT records.

dig TXT google.com

Task 6

Perform a reverse lookup.

dig -x 8.8.8.8

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

  1. What is a DNS record?
  2. What is an A record?
  3. What is an AAAA record?
  4. What is a CNAME record?

Intermediate

  1. Explain MX records.
  2. What is a PTR record?
  3. What is an SOA record?
  4. What is TTL?

Architect Level

  1. Design DNS records for a multi-region enterprise application.
  2. Explain how DNS records support cloud load balancers.
  3. 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?

DNS Resolution

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.