Learn what CNAME records do, when to use them, and common mistakes with aliases, root domains, MX records and third-party services.

Quick wins from this guide
  • Understand DNS aliases
  • Avoid root domain mistakes
  • Check third-party service records

What a CNAME does

A CNAME record points one hostname at another hostname. It does not point directly at an IP address. For example, www.example.com might be an alias of example.hosting-provider.net.

Good use cases

CNAME records work well for subdomains used by shops, documentation platforms, CDNs, status pages and hosted services. They let the service provider change the final IP addresses without asking you to update your DNS every time.

Common mistakes

Avoid using a CNAME where other records must exist for the same name. Also avoid pointing MX or NS records at a CNAME. If a provider gives exact DNS instructions, follow their hostname and record type carefully.

How to check one

Use DNSNow with the CNAME type, or run dig www.example.com CNAME. If there is no CNAME, check whether the hostname has A or AAAA records instead.

Quick commands to try

dig example.com A
dig example.com MX +short
host -t TXT example.com

Practise the command line side

DNSNow gives you quick web checks. For hands-on Linux command practice, use CommandLineQuiz dig Command Builder, the Linux Troubleshooting Hub and the Bash Scripting Hub.

FAQs

Can a CNAME point to an IP address?

No. A CNAME points to another hostname, not directly to an IP address.

Can the root domain use a CNAME?

Traditional DNS rules make this difficult because the root usually needs other records. Some providers offer flattening or ALIAS style features.

Can MX records point to CNAME records?

They should not. MX records should point to hostnames that resolve directly with A or AAAA records.

Sources and further reading