CNAME record

From Wikipedia, the free encyclopedia

A Canonical Name (CNAME) record is a type of resource record in the Domain Name System (DNS) that maps one domain name (an alias) to another (the canonical name).[1]

This can prove convenient when running multiple services (like an FTP server and a web server, each running on different ports) from a single IP address. One can, for example, use CNAME records to point and to the DNS entry for, which in turn has an A record which points to the IP address. Then, if the IP address ever changes, one only has to record the change in one place within the network: in the DNS A record for

CNAME records must always point to another domain name, never directly to an IP address.


DNS CNAME records are specified in RFC 1034 and clarified in Section 10 of RFC 2181.

CNAME records are handled specially in the domain name system, and have several restrictions on their use. When a DNS resolver encounters a CNAME record while looking for a regular resource record, it will restart the query using the canonical name instead of the original name. (If the resolver is specifically told to look for CNAME records, the canonical name (right-hand side) is returned, rather than restarting the query.) The canonical name that a CNAME record points to can be anywhere in the DNS, whether local or on a remote server in a different DNS zone.

For example, if there is a DNS zone as follows:

NAME                    TYPE   VALUE
--------------------------------------------------        CNAME        A

when an A record lookup for is carried out, the resolver will see a CNAME record and restart the checking at and will then return

Possible confusion[edit]

With a CNAME record, one can point a name such as "" to "" Because of this, during casual discussion the (left-hand) side of a DNS entry can be incorrectly identified as "the CNAME" or "a CNAME." However, this is inaccurate. The canonical (true) name of "" is "" Because CNAME stands for Canonical Name, the right-hand side is the actual "CNAME"; on the same side as the address "A".

This confusion is specifically mentioned in RFC 2181, "Clarifications to the DNS Specification." The left-hand label is an alias for the right-hand side (the RDATA portion), which is (or should be) a canonical name.[2] In other words, a CNAME record like this:        CNAME

may be read as: is an alias for the canonical name (CNAME) A client will request and the answer will be


  • CNAME records must always be pointed to another domain name, never to an IP address.
  • If a CNAME record is present at a node, no other data should be present; this ensures that the data for a canonical name and its aliases cannot be different. (RFC 1034 section 3.6.2, RFC 1912 section 2.4) The exception is when DNSSEC is being used, in which case there can be DNSSEC related records such as RRSIG, NSEC, etc. (RFC 2181 section 10.1)
  • CNAME records that point to other CNAME records should be avoided due to their lack of efficiency, but are not an error.[3] It is possible, then, to create unresolvable loops with CNAME records, as in:  CNAME  CNAME
  • a CNAME record cannot be present at the zone apex. RFC 1034 section 4.2.1[4] demands a SOA record at the zone apex and RFC 1034 section 3.6.2[5] demands that are no other records be present if a CNAME record is present. Therefore a CNAME record cannot appear at the zone apex.
  • CNAME records that are served by DNAME records may cause recursive loops in older resolvers.[clarification needed]
  • MX and NS records must never point to a CNAME alias (RFC 2181 section 10.3). So, for example, a zone must not contain constructs such as:      MX     0  CNAME A
  • Domains that are used in the SMTP MAIL and RCPT commands may not have a CNAME record.[6] In practice this may work, but can have different behavior with different mail servers, and can have undesired effects.[7]

DNAME record[edit]

A DNAME record or Delegation Name record is defined by RFC 6672 (original RFC 2672 is now obsolete). The DNAME record provides redirection (alias) for a subtree of the domain name tree in the DNS. That is, all names that end with a particular suffix are redirected to another part of the DNS. In contrast, the CNAME record creates an alias for a single name and not its subdomains. Like the CNAME record, the DNS lookup will continue by retrying the lookup with the new name. The name server synthesizes a CNAME record to actually apply the DNAME record to the requested name—CNAMEs for every node on a subtree have the same effect as a DNAME for the entire subtree.

For example, if there is a DNS zone as follows:        DNAME        A  A
*      A

An A record lookup for will return no data because a DNAME is not a CNAME and there is no A record directly at foo.

However, a lookup for will be DNAME mapped and return the A record for, which is; if the DNAME record had been a CNAME record, this request would have returned name not found.

Lastly, a request for would be DNAME mapped and return

ANAME record[edit]

Several managed DNS platforms implement a non-standard ALIAS[8] or ANAME[9] record type. These pseudo records are managed by DNS administrators like CNAME records, but are published and resolved by (some) DNS clients like A records. ANAME records are typically configured to point to another domain, but when queried by a client, answer with an IP address. While ANAME record types was submitted for standardization,[10] there are other non-conforming implementations, so they can do whatever the owner of the DNS platform chooses, including existing at the apex of a zone and existing for domains that receive mail.

Main advantage of ANAME records over CNAME records is that it can be used on zone apex, while standard-following resolver will not tread domain name with CNAME record as zone apex.[11] Also, while a DNS client requires at least two queries to resolve a CNAME to an A record to an IP address, having ANAME will shift the second and subsequent query to the server. If the DNS server can resolve the A record and cache the requested IP address more efficiently and with less latency than its DNS clients can, then the DNS client can get the resolution faster.

The ANAME record type was submitted as a draft standard to IETF, however the latest draft document has expired in January 2020.[10] and has been superseded by a series of proposals, with the most recent one is the one for SVCB and HTTPS record type.[12]

See also[edit]


  1. ^ Mockapetris, P. (November 1987). "RFC 1035 - Domain names - implementation and specification". Internet Engineering Task Force. Retrieved 16 March 2019.
  2. ^ "RFC 2181: Clarifications to the DNS Specification". IETF. July 1997. Retrieved 2011-03-09.
  3. ^ Mockapetris, P. (November 1987). "RFC 1034 - Domain names - concepts and facilities". Internet Engineering Task Force. Retrieved 15 July 2019.
  4. ^ Mockapetris, P. (November 1987). "RFC 1034 section 4.2.1". Retrieved 15 July 2019.
  5. ^ Mockapetris, P. (November 1987). "RFC 1034 section 3.6.2". Retrieved 15 July 2019.
  6. ^ Braden, R. (October 1989). "RFC1123 - MAIL - SMTP & RFC-822". Retrieved 23 July 2020.
  7. ^ Bernstein, D. J. "CNAME records in mail". Retrieved 3 June 2011.
  8. ^ "ALIAS Records". Retrieved 2019-07-26.
  9. ^ "ANAME Records". Retrieved 2022-09-24.
  10. ^ a b "Address-specific DNS aliases (ANAME)". 2019-07-08. Retrieved 2019-07-26.
  11. ^ Goldlust, Suzanne; Almond, Cathy. "CNAME at the apex of a zone". ISC's Open Source Knowledgebase. Internet Systems Consortium. Retrieved 8 April 2023.
  12. ^ Schwartz, B.; Bishop, M.; Nygren, E. (2023-03-11). "Service binding and parameter specification via the DNS (DNS SVCB and HTTPS RRs)". Retrieved 2023-04-08.

External links[edit]

  • RFC 1912 is wrong – Meng Weng Wong's analysis of CNAME restrictions
  • RFC 2219 – Use of DNS Aliases for Network Services