CNAME records

Last change on 2021-03-16 • Created on 2020-04-01 • ID: DN-D98EF

Unlike A records, which point domains/subdomains to IPs, CNAME records point to other domain names. These are also often called alias records. CNAME stands for Canonical Name. When a name server looks up a name and finds a CNAME record, it switches out the cononical name and looks it up.

When you enter a value for a CNAME record, you need to enter a domain/subdomain that already exists. You can set up a hostname to point to your A record for a subdomain, which in turn points to an specific IP address. That way, if you change the value for the subdomain, the CNAME will then automatically point to the correct subdomain and IP.

Let's imagine that you have both your-domain.com and www.your-domain.com. You can create an A record for your-domain.com that points to the server IP address. And you can set a CNAME record for www.your-domain.com that points to your-domain.com. So if the IP address ever changes, you only need to update it in one place: the A record for your-domain.com.

In fact, you can have multiple systems all pointing to one IP address that has one A record.

There are some important things to keep in mind with CNAME records:

  1. CNAME records never point to IP addresses. They only point to other domain/subdomain names. And these names must already exist.
  2. You cannot have a CNAME record for a domain name that already has another record. For example, you cannot have both a TXT record and CNAME record for www.your-domain.com.
  3. You can set up a CNAME to point to another CNAME, but this is not always recommended. It's usually better to point the CNAME as directly as possible to the domain/subdomain name.
  4. The domain names must be fully qualified domain names (FQDN).
  5. CNAME records are not the same as web (HTTP) redirects. You cannot set up HTTP redirects using CNAME records.