CNAME record

For RTCP CNAME records, see RTP Control Protocol.

A Canonical Name record (abbreviated as CNAME record) is a type of resource record in the Domain Name System (DNS) used to specify that a domain name is an alias for another domain, the "canonical" domain. All information, including subdomains, IP addresses, etc., are defined by the canonical domain.

This can prove convenient when running multiple services (like an FTP server and a webserver; each running on different ports) from a single IP address. One can, for example, point ftp.example.com and www.example.com to the DNS A record for example.com, which in turn 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.

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

Details

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
--------------------------------------------------
bar.example.com.        CNAME  foo.example.com.
foo.example.com.        A      192.0.2.23

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

On which side of the record is the "CNAME" indicated?

A CNAME record one can point a name such as "bar.example.com" to "foo.example.com." Because of this, during casual discussion the "bar.example.com." (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 "bar.example.com." is "foo.example.com." Because CNAME stands for Canonical Name, the right-hand side is the actual "CNAME."

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.[1] In other words, a CNAME record like this:

bar.example.com.        CNAME  foo.example.com.

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

Restrictions

foo.example.com.  CNAME  bar.example.com.
bar.example.com.  CNAME  foo.example.com.
example.com.      MX     0   foo.example.com.
foo.example.com.  CNAME  host.example.com.
host.example.com. A      192.0.2.1

DNAME record

A DNAME record or Delegation Name record is defined by RFC 6672 (original RFC 2672 is now obsolete). A DNAME record creates an alias for an entire subtree of the domain name tree. 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. If a DNS resolver sends a query without EDNS, or with EDNS version 0, then a name server sends multiple CNAME records to simulate the DNAME record—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:

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

An A record lookup for foo.example.com will fail because a DNAME is not a CNAME.

However, a look up for xyzzy.foo.example.com will be DNAME mapped and return the A record for xyzzy.bar.example.com which is 192.0.2.24; if the DNAME record had been a CNAME record, this request would have failed.

Lastly, a request for foobar.foo.example.com would be DNAME mapped and return 192.0.2.25.

See also

References

  1. "RFC 2181: Clarifications to the DNS Specification". IETF. July 1997. Retrieved 2011-03-09.
  2. Mockapetris, P. (November 1987). "RFC1034 - Domain Names, Concepts and Facilities". ISI. Retrieved 16 April 2011.
  3. Braden, R. (October 1989). "RFC1123 - MAIL - SMTP & RFC-822". Retrieved 3 June 2011.
  4. Bernstein, D.J. "CNAME records in mail". Retrieved 3 June 2011.

External links

This article is issued from Wikipedia - version of the Friday, April 15, 2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.