DNS Records Explained

DNS (Domain Name System) is important to our daily internet use because it acts as the internet's address book.

Without DNS, we would have to remember complex IP addresses to visit our favorite websites, send emails, or use online services. Instead, DNS translates easy-to-remember domain names, like ww.example.com, into the numerical IP addresses (something like 192.0.2.1) that computers use to identify each other on the network.

In this article, I'll share what these different records are and how they are used:

A Record (Address Record)

What it is: Maps a domain name to an IPv4 address.

When to use it: When you want to point your domain to a server with an IPv4 address.

Example: example.com ➡️ 192.0.2.1

AAAA Record (IPv6 Address Record)

What it is: Maps a domain name to an IPv6 address.

When to use it: When you want to point your domain to a server with an IPv6 address.

Example: example.com ➡️ 2001:0db8:85a3:0000:0000:8a2e:0370:7334

CNAME Record (Canonical Name Record)

What it is: Maps an alias name to a true or canonical domain name.

When to use it: When you want one domain to be an alias of another domain. This is useful for pointing subdomains to a main domain.

Example: blog.example.com ➡️ www.example.com

MX Record (Mail Exchange Record)

What it is: Directs email to a mail server.

When to use it: When you want to specify the mail server responsible for receiving email on behalf of your domain.

Example: example.com ➡️ mail.example.com (priority 10)

TXT Record (Text Record)

What it is: Holds text information for various purposes.

When to use it: When you need to include human-readable notes, SPF records for email validation, or domain verification codes.

Example: If you need to verify your domain ownership for Google Workspace, you might add a TXT record like this: example.com ➡️ "google-site-verification=abc123xyz456". Another example is for setting up SPF to prevent email spoofing: example.com ➡️ "v=spf1 include:_spf.example.com ~all".

NS Record (Name Server Record)

What it is: Specifies the DNS servers for your domain.

When to use it: When you delegate a domain or subdomain to a set of DNS servers.

Example: example.com ➡️ ns1.example.com, ns2.example.com

SOA Record (Start of Authority Record)

What it is: Contains administrative information about the zone, such as the primary name server, domain administrator's email, and domain serial number.

When to use it: Automatically created when a domain is registered, it’s important for DNS zone transfers and management.

Example: example.com ➡️ ns1.example.com (serial: 2023051701, admin email: admin@example.com)

SRV Record (Service Record)

What it is: Specifies the location of a server for specific services.

When to use it: When you need to specify servers for services like SIP, LDAP, etc.

Example: _sip._tcp.example.com ➡️ 10 60 5060 sipserver.example.com

PTR Record (Pointer Record)

What it is: Maps an IP address to a domain name (reverse DNS lookup).

When to use it: When verifying the hostname associated with an IP address, often used in email server configurations.

Example: 192.0.2.1 ➡️ example.com

CAA Record (Certification Authority Authorization Record)

What it is: Specifies which certificate authorities (CAs) are allowed to issue certificates for a domain.

When to use it: When you want to control and restrict which CAs can issue SSL/TLS certificates for your domain.

Example: example.com ➡️ 0 issue "letsencrypt.org"

Hopefully, this will give you the confidence to change things without worrying, which was my main problem when I started playing with DNS records.

FundamentalsInternetCloud
Avatar for Niall Maher

Written by Niall Maher

Founder of Codú - The web developer community! I've worked in nearly every corner of technology businesses; Lead Developer, Software Architect, Product Manager, CTO and now happily a Founder.

Loading

Fetching comments

Hey! 👋

Got something to say?

or to leave a comment.