CNAME resource record

from Wikipedia, the free encyclopedia

A CNAME Resource Record ( CNAME RR ) is provided in the Domain Name System (DNS) to assign another name to a domain. The abbreviation "CNAME" stands for canonical name (English canonical = recognized) and therefore designates the primary, quasi real name.

In the simplest case, the further domain name ("alias") defined by a CNAME resource record refers to the domain name part in an A resource record (or an AAAA resource record ). This resource record then connects the original domain name with an IP address . When changing an IP address, only this resource record has to be changed and all aliases defined by the CNAME resource record also refer to the new IP address. In return, the name resolution via the CNAME resource record is more complex.

CNAME Resource Records are defined in the Internet standards RFC 1034 and RFC 1035 from 1987 and clarified again in RFC 2181 from 1997, because the related performance requirements of the standards were ignored.

The concept of the canonical name has often been interpreted as a restriction on having to determine an ultimately official name. From this it was in turn derived that other names should only be from CNAME resource records, but not refer to other CNAME resource records. In fact, it means that it does not have to be the name of another resource record, but that the name can only be recognized somewhere outside of the domain name system.

An NS , MX , PTR, or SRV resource record cannot reference a CNAME resource record. Conversely, a PTR resource record may only be accessible via a CNAME resource record. The name of a CNAME resource record must not be used as the name of other resource records, as it stands for all resource records of the target. The only exception to this are the Domain Name System Security Extensions .

syntax

                 <Name> IN CNAME <Ziel>

Examples

In the following simple example, a host name with an IP address is first created with an A record and an AAAA record and then this CNAME is referred to with a CNAME RR (the term “CNAME” confusingly refers to the right side of the CNAME RR , it denotes the actual or original name of the domain and does not denote the left part, i.e. the "alias"; however, the alias is often incorrectly referred to as "CNAME"):

       www.example.com. IN A     192.0.2.42
                        IN AAAA  2001:db8::42
       www.example.net. IN CNAME www.example.com.

Multiple CNAME resource records can refer to the same target, but they can also be nested:

       www.example.com. IN A     192.0.2.42
                        IN AAAA  2001:db8::42
       www.example.org. IN A     192.0.2.42
                        IN AAAA  2001:db8::42
       www.example.net. IN CNAME www.example.com.
       en.example.net.  IN CNAME www.example.net.
       de.example.net.  IN CNAME www.example.net.

Name resolution

When a name server receives a request for which a CNAME RR exists, it resolves as far as possible to the IP address. In the example, the name server recognizes that www.example.com cannot yet be the desired response to the request for www.example.net.

In addition to the IP address, the canonical name is also transferred in the response . In this way, the client can see that its original request referred to an alias.

An nslookup under Windows would provide the following answer:

       C:\>nslookup www.example.net
       Server:  router.box
       Address:  fd00::2666:12ff:feaf:581f
       Nicht autorisierende Antwort:
       Name:    www.example.com
       Addresses:  2001:db8::42
                 192.0.2.42
       Aliases:  www.example.net

On Unix systems, the output of the host program would be :

      $ host www.example.net
      www.example.net is an alias for www.example.com.
      www.example.com has address 192.0.2.42
      www.example.com has IPv6 address 2001:db8::42

It can happen that a name server cannot resolve to the IP address. In this case it just returns the CNAME. The client must then try to resolve this name further in another way.

restrictions

No further RR (A record, AAAA record, MX record etc.) may be set for an alias in a CNAME record.

If a CNAME RR is present at a node, no other data should be present (...)

CNAME records may therefore only be used for subdomains, since a main domain always has an SOA record , one to five NS records and usually an MX record (since email addresses usually do not contain any subdomains). It can happen that users of such a false CNAME record cannot receive e-mails from certain MTA servers .

Inadmissible:

    example.com.      CNAME     somedomain.example.
    example.com.      A         192.0.2.42

However, it is permissible because there are different names:

    example.com.      A         192.0.2.42
    www.example.com.  CNAME     example.com.

Individual evidence

  1. RFC 2181 - Clarifications to the DNS Specification . Internet Engineering Task Force . July 1997. Retrieved July 10, 2011.
  2. RFC 1034 - DOMAIN NAMES - CONCEPTS AND FACILITIES . Internet Engineering Task Force . July 1997. Retrieved May 7, 2012.