DNS Records Explained: A, CNAME, MX, TXT, and the Rest

A DNS record tells resolvers one fact about your domain. An A record gives its IPv4 address, AAAA gives its IPv6 address, CNAME points one name at another name, MX names the servers that accept its mail, and TXT holds text that other systems read, which in practice means mail authentication and ownership proofs.

That is DNS records explained in a paragraph. Five types cover almost everything. The rest of this post is about the part that actually costs people afternoons: which record is responsible for which failure, why a change you made an hour ago has not taken effect, and how to find out what is published rather than guessing.

Nameservers or Records: Which One Are You Editing?

Two different systems are involved, and support tickets on this subject are almost always somebody editing the wrong one.

Your registrar holds a delegation: a short list of nameservers, published by the registry for your extension, that says which servers are authoritative for your domain. Those nameservers hold the zone, and the zone holds the records. The delegation answers who decides. The records answer what the answer is. Editing an A record in a control panel belonging to a set of nameservers your domain is not delegated to changes nothing at all, and it will keep changing nothing for as long as you stare at it.

You can see the delegation in one command:

dig example.com NS +short

Compare that against whose interface you are typing into. If the names do not match, you found the problem.

Move the records, not the nameservers, when all you need to do is move a website. Changing the delegation hands your entire zone to a new provider, including mail routing and any verification records you have forgotten about, and the registry-level TTLs on a delegation are longer than the ones inside your own zone and are not yours to shorten.

The Address Records: A and AAAA

An A record maps a hostname to an IPv4 address. AAAA does the same for IPv6. Both are as simple as they look, and both fail in ways that do not look like DNS problems at all.

A stale A record is the classic. The site loads, so nothing appears broken, except the visitor is being served by a machine you stopped paying for last month, and the changes you have been publishing all week are landing somewhere nobody can see. Anyone who has moved a site has done this once.

AAAA is the more interesting failure. If you publish an AAAA record and the server behind it is not actually listening on that address, visitors on IPv6 connections fail while everybody else is fine, and the two groups cannot reproduce each other's experience. That asymmetry is what makes it expensive to diagnose. Publish an AAAA record only after you have tested the site over IPv6 yourself. A missing one costs you nothing, and a wrong one costs you the visitors least able to explain what they are seeing.

CNAME Is an Alias, and It Has Rules

A CNAME points a name at another name rather than at an address. Ask for shop.example.com, get told the real answer lives at example-shop.somehost.net, follow that, resolve it. Content delivery networks and hosted store platforms both hand you a CNAME target for exactly this reason: they can change addresses underneath you without asking you to edit anything.

The rule people run into is that a name with a CNAME on it may not carry any other record. That is not a provider limitation, it is RFC 1034, and the consequence is specific. Your root domain already carries NS and SOA records because it is the top of the zone, so a CNAME cannot legally sit there. Try it and a careful DNS provider refuses the entry, while a careless one accepts it and your mail stops, because the MX records at that name are now unreachable.

Some providers offer ALIAS, ANAME, or "CNAME flattening" at the root. These are not a new record type; the nameserver resolves the target itself and answers with an A record, which works fine until the day you leave that provider.

One more property. A CNAME inherits nothing from its target except the address, so the target's MX and TXT records are not yours and never were.

MX Records Route Mail, and Nothing Else

An MX record names a hostname that accepts mail for your domain, plus a preference number. Lower numbers are tried first. Backup mail servers get higher numbers, which reads backward the first few times you look at it.

The most common mistake is pointing MX at whichever server runs the website. Mail and web are separate services that happen to share a name. If your mailboxes are with one provider and your site is with another, the MX records point at the mail provider and the A record points at the web host, and neither one knows or cares about the other.

MX must name a hostname, not an IP address. RFC 5321 is explicit about it, and a sending server that finds an address literal there will simply not deliver.

Changing an MX record takes effect for new mail almost immediately, for everyone, and moves not a single message that has already been delivered. Mail already sitting in mailboxes on the old server stays on the old server. That is the trap underneath most mail-related migration disasters, and the sequence for avoiding it is covered in what to check before you move your website to a new host.

TXT Records Carry What Other Systems Read About You

TXT was designed as a place to put arbitrary text, and the internet filled it with machine-readable policy. Almost everything in your TXT records today is either proving you own the domain or telling receiving mail servers which senders to believe.

  • SPF lists the hosts allowed to send mail as your domain, published at the domain itself. You may publish exactly one, and two SPF records is a hard failure rather than a merge, per RFC 7208. Adding a second one while onboarding a new mail tool is how most people break their own outbound mail.
  • DKIM public keys sit at a selector name such as selector1._domainkey.example.com, one per sending system, which is why they multiply.
  • DMARC lives at _dmarc.example.com and tells receivers what to do when SPF and DKIM disagree with each other.
  • Verification tokens from search consoles and payment platforms are also TXT records, and unlike the three above they are safe to delete once the service has confirmed.

Audit them once a year. A leftover token for a product nobody has logged into since the month it was bought is harmless on its own, but a zone full of them is a public list of every vendor the company has ever tried, which is not something anybody meant to publish.

TTL Is a Promise You Make to Everybody Else's Resolvers

Every record carries a time to live, in seconds. It is not a countdown on your side. It is the length of time you are telling every resolver on the internet that it may keep serving a copy of this answer without asking you again, and the value that governs right now is the one attached to the copy already sitting in those caches.

That single fact explains what people call propagation. Nothing propagates. Your authoritative nameservers change instantly, and the rest of the world catches up as each cached copy expires on its own schedule, which is why the change is visible to you, invisible to your client, and half visible to somebody on a mobile network, all at the same minute. A resolver that cached your record with a one hour TTL forty minutes ago owes you nothing for another twenty minutes.

Absence gets cached too. A lookup that returns nothing is cached according to the SOA record's minimum field under RFC 2308, so a record you added a minute after somebody first tried it can stay missing for them well after it exists.

An hour is a sensible default TTL for records that rarely change. Drop the ones you are about to edit to five minutes at least a full old-TTL period before you touch them, then put them back afterward, because a permanently short TTL just means more queries against your nameservers for a flexibility you use twice a year.

If a Change Has Not Appeared Yet, Ask the Nameserver Yourself

dig is on macOS and most Linux systems, and it prints exactly what came back:

dig +noall +answer example.com A dig +noall +answer example.com MX dig +noall +answer example.com TXT

The number in the third column is the remaining TTL on the copy your resolver is holding. Watch it count down.

Two flags do most of the diagnostic work. Querying a specific resolver tells you whether a problem is yours or theirs:

dig @1.1.1.1 example.com A dig @8.8.8.8 example.com MX

And querying your own authoritative nameserver directly separates "not published" from "published, but not expired from caches yet," which is the single most useful distinction available while you are waiting on a change:

dig @ns1.example.net example.com A

If the authoritative server has the new value and a public resolver does not, you are finished. Wait.

On Windows, nslookup covers the same ground with different syntax, taking the record type as a flag and the resolver as a trailing argument:

nslookup -type=MX example.com nslookup -type=TXT example.com 8.8.8.8

Your own machine caches separately from all of this, and your browser caches on top of that, so flush with ipconfig /flushdns on Windows and trust the terminal rather than a page that still looks wrong in Chrome.

Every Record Type You Are Likely to Meet

Record Answers A realistic use
A Which IPv4 address serves this name example.com to your web server's address
AAAA Which IPv6 address serves this name The same host, published only after you test it over IPv6
CNAME What is this name an alias for shop.example.com to a hosted store platform's hostname
MX Which servers accept mail for this domain Two records at different preferences, pointing at your mail provider
TXT What text should other systems read here SPF, a DKIM key, DMARC policy, a verification token
NS Which nameservers are authoritative Delegating dev.example.com to a separate provider
SOA Who owns this zone and how is absence cached One per zone, usually written for you
SRV Which host and port run this service Autodiscover for a mail or chat client
CAA Which authorities may issue certificates for this name Restricting issuance to the one authority you actually use
PTR Which name belongs to this address Reverse lookup for a mail server, set by whoever owns the address block

PTR is the one that surprises people, because it lives in the address owner's zone rather than yours. If you send mail from your own server and receivers are suspicious of it, the reverse record is usually a request to your host rather than an edit you can make.

Where to Start

Run the three dig commands above against your own domain right now, before you need them, and read the answers next to what you believe is published. Zones drift. An A record for a subdomain that stopped existing years ago, or an SPF record listing a mail service nobody remembers buying, is not something you want to discover during an outage.

Where the domain and the hosting sit in the same place, the records are usually a page in the control panel rather than a file you edit; on BestPaidHosting accounts that page is the Hepsia domain manager. If you are still choosing the name that all of these records will hang off, the tests a domain name should survive come before any of this.

Then write down your nameservers somewhere you will find them again. The next time something breaks at three in the afternoon, knowing which interface is authoritative saves you the first twenty minutes.

Leave a Comment

Your email address will not be published. Required fields are marked *