Share on Facebook Share on Twitter Email
Answers.com

CNAME record

 
Wikipedia: CNAME record

A CNAME record or Canonical Name record is a type of resource record in the Domain Name System (DNS) that specifies that the domain name is an alias of another, canonical domain name. This helps when running multiple services (like an FTP and a webserver; each running on different ports) from a single IP address. Each service can then have its own entry in DNS (like ftp.example.com. and www.example.com.). Network administrators also use CNAMEs when running multiple HTTP servers on the same port, with different names, on the same physical host.

Contents

Details

CNAME records are specified in RFC 1034. CNAMEs 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. When the resolver is told to look for CNAME records, the CNAME is returned, rather than restarting the query. The canonical name that a CNAME 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:

foo.example.com.        CNAME  bar.example.com.
bar.example.com.        A      192.0.2.23

When an A record lookup for foo.example.com is done, the resolver will see a CNAME record and restart the checking at bar.example.com and will then return 192.0.2.23.

Terminology of CNAME vs "canonical name"

It has been traditional to refer to the label of a CNAME record as "a CNAME". This is unfortunate, as "CNAME" is an abbreviation of "canonical name", and the label of a CNAME record is most certainly not a canonical name. It is, however, an entrenched usage. Care must therefore be taken to be very clear whether the label, or the value (the canonical name) of a CNAME resource record is intended. (Quoting from RFC 2181 section 10.1.1)

So, technically, a canonical name in the DNS is the primary name of a host (RFC 1034 section 3.6.2.) created by something other than a CNAME, or DNAME record. A CNAME record creates an alias with a name on the left which points to a canonical name specified on the right (the RDATA portion of the record).

Restrictions

  • CNAME must have no other resource records of other types (MX, A, etc.). (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 a DNSSEC related records such as RRSIG, NSEC, etc. (RFC 2181 section 10.1)
  • CNAME records that point to other CNAME records should be avoided (RFC 1034 section 5.2.2). In particular, it is possible to create infinite loops with CNAME records, and other error conditions, as:
foo.example.com.  CNAME  bar.example.com.
bar.example.com.  CNAME  foo.example.com.
  • Other DNS record types, such as NS, MX, PTR, SRV, etc. that point to other names should never point to a CNAME. (RFC 1034 section 3.6.2, RFC 1912 section 2.4) So, for example, a zone should not contain constructs such as:
foo.example.com.  CNAME  host.example.com.
host.example.com. A      192.0.2.1
example.com.      MX     0   foo.example.com.

DNAME record

A DNAME record or Delegation Name record is defined by RFC 2672. A DNAME record will delegate an entire portion of the DNS tree under a new name. In contrast, the CNAME record creates an alias of a single name. Like the CNAME record, the DNS lookup will continue by retrying the lookup with the new name. If a DNS resolver sends a query without EDNS, or with EDNS version 0, then a name server synthesizes a CNAME record to simulate the semantics of the DNAME record.

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

foo.example.com.        DNAME  bar.example.com.
bar.example.com.        A      192.0.2.23
xyzzy.bar.example.com.  A      192.0.2.24

An A record lookup for foo.example.com will return 192.0.2.23, just as if the DNAME was a CNAME. However, unlike a CNAME, a lookup for xyzzy.foo.example.com will return the A record for xyzzy.bar.example.com which is 192.0.2.24.

See also

External links


Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics
 
 

 

Copyrights:

Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "CNAME record" Read more