cPanelOps · Hosting guides for site operators
cPanelOpsv2.2.0
Plain-English cPanel help from the team behind FirstResponderHost
26 guides live
CpanelOps / PageOps

Home › Guides

Basics

DNS records for site owners: A, CNAME, MX, TXT and what TTL means

The handful of DNS records that control where your site and email go, how to edit them in cPanel, and the mistakes that take sites offline.

DNS is the address book of the internet. When someone types your domain, their device asks DNS where to find it, and DNS answers with whatever you have published. Get a record wrong and the site, the email, or both go somewhere else or nowhere. There are only a few record types to know.

First: find out who runs your DNS

This is the step people skip. Your domain has nameservers, set at the company where you registered it. Those nameservers are the only place where your records count. If the nameservers point at your hosting company, you edit records in cPanel's Zone Editor. If they point at the registrar or at a service such as Cloudflare, you edit them there, and anything you change in cPanel is ignored.

Many hours are lost editing the right record in the wrong place. Look up the nameservers at the registrar before you change anything.

The record types

TypeWhat it doesExample value
APoints a name at a server's IPv4 address.203.0.113.10
AAAAThe same for an IPv6 address.2001:db8::10
CNAMESays "this name is another name for that one".www → yourdomain.com
MXSays which server receives email for the domain.10 mail.yourdomain.com
TXTHolds text that other services read: SPF, DKIM, site verification.v=spf1 +a +mx ~all
NSNames the nameservers. Normally set at the registrar, not edited by hand.ns1.hostname.com

What a normal small site has

  • An A record for the bare domain, pointing at the hosting server.
  • A record for www, either a CNAME to the bare domain or its own A record with the same address.
  • One or more MX records for email.
  • TXT records for SPF, DKIM and DMARC (see the email guide).

When hosting and email are both on the same cPanel account, cPanel creates all of these for you.

Editing in cPanel

  1. Open Zone Editor and click Manage beside the domain.
  2. To change a record, click Edit on its row. To add one, use Add Record and pick the type.
  3. Names are entered in full and end with a dot, such as blog.yourdomain.com. cPanel usually adds the dot for you.
  4. Save, then test.

TTL and the myth of "propagation"

Each record has a TTL, a time to live, in seconds. It tells everyone who looks the record up how long they may remember the answer before asking again. That is all "propagation" is: old answers expiring from memory around the world. With a TTL of 14400, a change can take up to four hours to be seen everywhere. With 300, about five minutes.

The practical use: a day or two before a planned move, lower the TTL on the records you are going to change to 300. On the day, the switch takes effect in minutes. Afterwards, raise it again.

Checking a record

From a terminal:

dig +short yourdomain.com A
dig +short yourdomain.com MX
dig +short yourdomain.com TXT

On Windows, nslookup -type=MX yourdomain.com does the same job. Online DNS lookup tools show what the record looks like from several countries at once, which is useful while a change is spreading.

Mistakes that cause outages

  • A CNAME on the bare domain. A CNAME cannot share a name with any other record, and the bare domain always has others. Use an A record there. Some DNS providers offer a special "flattening" record to work around it.
  • MX pointing at an IP address. MX must point at a name, and that name must have an A record.
  • Changing the A record and forgetting email. If the MX record points at mail.yourdomain.com and that name follows the site to a new server with no mailboxes, mail starts bouncing.
  • Two SPF records. Adding a second v=spf1 record breaks both. Merge them into one.
  • Deleting records you do not recognize. Verification and DKIM records look like gibberish and are easy to remove by accident. Export or screenshot the zone before tidying.
  • Leaving out www. The bare domain works, the www form does not, and half your visitors type it.

Common questions

I changed a record an hour ago and still see the old site.

Your own computer and browser also remember answers. Try another network, such as a phone on mobile data, before deciding the change failed.

Can the site and the email be at different companies?

Yes, and it is common. The A record points at the web host and the MX records point at the email provider. Each provider tells you which records to add.

Should I move my DNS to a separate provider?

It is not necessary for a small site. The benefit is that DNS keeps working while you change hosts, and some providers add protection and speed features. The cost is one more place to manage.

Spotted a mistake, or a step that has changed?

cPanel's screens differ a little between versions and hosts. Tell us at info@firstresponderhost.com and we will correct the guide.

More guides