Domain DNS Records Made Simple: A, CNAME, MX and TXT

Topic: Web Hosting Level: Beginner 3 min read By the ITPlus724 team

A company domain is just a name. Where that name sends visitors and which mailbox receives its email is set in its DNS settings. One small mistake there can take the website offline or send customer email to a server nobody reads anymore. That is why every IT manager should know exactly what each record does.

Where is a domain’s DNS managed?

Every domain has NS records that specify which nameservers are authoritative for it. These servers may belong to the domain registrar, the hosting company or a separate DNS service. The key point is that record changes only take effect where the domain’s NS records point. A lot of confusion starts when someone changes a record in the hosting panel while the domain’s DNS is actually managed somewhere else.

The main records

  • A: Maps a name to an IPv4 address; for example, company.com to 203.0.113.20. Your website is usually found through this record.
  • AAAA: Does the same as an A record, but for IPv6 addresses.
  • CNAME: Makes one name an alias of another; for example, www.company.com to company.com. When the main name’s IP changes, the alias follows automatically.
  • MX: Specifies which server receives the domain’s email. Each MX record has a priority number, and a lower number means higher priority.
  • TXT: Text that other services read, from domain ownership verification for a service to the SPF, DKIM and DMARC records covered in a separate guide.
  • PTR: The reverse of an A record; it maps an IP address back to a name. This record is not in your domain panel; the owner of the IP address, meaning the data center or internet provider, sets it. It is very important for mail servers.

A few often-ignored rules

  • Don’t put a CNAME record on the root domain (company.com with no prefix). The root has other records such as NS and MX, and a CNAME cannot coexist with other records of the same name. Use an A record for the root.
  • An MX target must be a name, not an IP address, and that name should have an A record, not a CNAME. For example, point MX to mail.company.com and give mail.company.com an A record pointing to the mail server’s IP.
  • If the website and email are on separate servers, they are independent. When moving the website, change only the A record and leave MX alone.
  • Note down every value before changing it, so you can revert if something goes wrong.

TTL: why do changes take a while?

Each record has a TTL, the time in seconds that other DNS servers cache the answer. If a record’s TTL is one day, some users may keep going to the old address for up to a day after a change. What is usually called “DNS propagation” is really just these caches expiring.

If you plan to move a website or email, lower the TTL of the relevant records a day or two beforehand, for example to 300 seconds, and raise it again when you’re done.

How to check your records

With nslookup on Windows or dig on Linux, you can see what answer the world gets for your domain:

  • nslookup -type=mx company.com to view MX records
  • nslookup -type=txt company.com to view TXT records
  • dig +short company.com A to view the website’s IP

It’s best to repeat the check against a public DNS server too, for example nslookup company.com 8.8.8.8, to make sure an old answer isn’t coming from your own internal network’s cache.

Checklist

  • The domain is registered in the company’s name, with a renewal reminder or auto-renewal.
  • You know where the domain’s NS records point, and the company, not a former contractor, controls access to that panel.
  • The A and MX records match the actual website and mail servers.
  • There is no CNAME on the root domain.
  • Old, unused records have been removed.
  • The mail server’s PTR is set correctly.
  • The list of records is documented somewhere.

ITPlus724 engineers can review and document your company’s DNS records and make any change without website or email downtime.

Request a free consultation Our services

Get a free consultation for your IT infrastructure

Our engineers review your current setup and recommend the best way forward.

An engineer is onlineReady to help right now
Request a consultation +98 21 9101 0265
Call nowFree consultation