DNSDomainsRecords5 min read

Manage your domain DNS

A, CNAME, MX, TXT and NS records explained, TTL, propagation and verification with dig/nslookup.


What is DNS?

DNS (Domain Name System) translates domain names (yourdomain.com) to IP addresses. DNS records tell the internet where to find your site, email and services.

DNS record types

A Record

Points a domain to an IPv4 address:

terminal
yourdomain.com    A    203.0.113.10
www               A    203.0.113.10

CNAME Record

Creates an alias pointing to another domain:

terminal
www               CNAME    yourdomain.com
blog              CNAME    yourdomain.com

CNAME cannot be used on the root domain, only on subdomains.

MX Record

Defines email servers:

terminal
yourdomain.com    MX    10    mail.yourdomain.com
yourdomain.com    MX    20    mail2.yourdomain.com

The number is priority (lower = higher priority).

TXT Record

Stores arbitrary text (SPF, DKIM, verifications):

terminal
yourdomain.com    TXT    "v=spf1 mx a ip4:203.0.113.10 ~all"

NS Record

Defines authoritative nameservers:

terminal
yourdomain.com    NS    ns1.baires.host
yourdomain.com    NS    ns2.baires.host

TTL (Time To Live)

TTL defines how long resolvers cache a record:

  • 300 (5 min): For frequently changed records
  • 3600 (1 hour): Standard value
  • 86400 (24 hours): For stable records

Before a migration, lower TTL to 300 in advance.

Common configurations

Point domain to your VPS

terminal
@       A       YOUR_VPS_IP
www     CNAME   yourdomain.com

Configure email with Google Workspace

terminal
@       MX    1     aspmx.l.google.com
@       MX    5     alt1.aspmx.l.google.com
@       TXT         "v=spf1 include:_spf.google.com ~all"

DNS propagation

DNS changes are not instant. Propagation can take:

  • Low TTL (300): 5-30 minutes
  • Standard TTL (3600): 1-4 hours
  • High TTL (86400): up to 48 hours

Verify records

bash
# Verify A record
dig yourdomain.com A +short

# Verify MX
dig yourdomain.com MX +short

# Verify TXT
dig yourdomain.com TXT +short

# Verify with nslookup
nslookup yourdomain.com

Use whatsmydns.net to check propagation status globally.

Recommendations

  • Always verify DNS changes with dig after applying them
  • Lower TTL before migrations
  • Document your DNS records in a separate file
  • Use Cloudflare as DNS for fast propagation (seconds)
  • Don't delete MX records if you have active email on the domain

Was this guide helpful?