Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
CNAME record
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{short description|Type of resource record in the Domain Name System (DNS)}} {{for|RTCP CNAME records|RTP Control Protocol}} 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 form|canonical]] name''').<ref>{{cite web |last1=Mockapetris |first=P. |date=November 1987 |title=RFC 1035 - Domain names - implementation and specification |url=https://tools.ietf.org/html/rfc1035#section-3.2.2 |publisher=Internet Engineering Task Force |access-date=16 March 2019}}</ref> This can prove convenient when running multiple services (like an [[File Transfer Protocol|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 ''ftp.example.com'' and ''www.example.com'' to the DNS entry for ''example.com'', 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 ''example.com''. CNAME records must always point to another domain name, never directly to an IP address. == Details == DNS CNAME records are specified in {{IETF RFC| 1034}} and clarified in Section 10 of {{IETF 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. However, 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, consider a DNS zone as follows: {{sxhl|2=zone| 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 lookup for ''foo.example.com'' and will then return 192.0.2.23. === Possible confusion === With 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"; 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.<ref>{{cite web |url=http://tools.ietf.org/html/rfc2181#section-10.1.1 |title=RFC 2181: Clarifications to the DNS Specification |date=July 1997 |access-date=2011-03-09 |publisher=[[Internet Engineering Task Force|IETF]] }}</ref> In other words, consider the following CNAME record: {{sxhl|2=zone|bar.example.com. CNAME foo.example.com.}} This may be read as saying that "''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 === {{unordered list |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.<ref name="RFC1034">{{cite web|url=https://tools.ietf.org/html/rfc1034|last=Mockapetris|first=P.|date=November 1987|title=RFC 1034 - Domain names - concepts and facilities|publisher=Internet Engineering Task Force|access-date=15 July 2019}}</ref> It is possible, then, to create unresolvable loops with CNAME records, as in: {{sxhl|2=zone|foo.example.com. CNAME bar.example.com. bar.example.com. CNAME foo.example.com.}} |A CNAME record cannot be present at the zone apex. RFC 1034 section 4.2.1<ref>{{cite web|url=https://tools.ietf.org/html/rfc1034#section-4.2.1|last=Mockapetris|first=P.|date=November 1987|title=RFC 1034 section 4.2.1|access-date=15 July 2019}}</ref> demands a [[SOA record]] at the zone apex and RFC 1034 section 3.6.2<ref>{{cite web|url=https://tools.ietf.org/html/rfc1034#section-3.6.2|last=Mockapetris|first=P.|date=November 1987|title=RFC 1034 section 3.6.2|access-date=15 July 2019}}</ref> demands that are no other records be present if a CNAME record is present. Therefore a CNAME record cannot appear at the zone apex. |{{clarify|date=November 2017|reason=needs an example and a citation; this issue may also be irrelevant for WP.|text=CNAME records that are served by DNAME records may cause recursive loops in older resolvers.}} |[[MX record|MX]] and [[NS record]]s must never point to a CNAME alias (RFC 2181 section 10.3). So, for example, a zone must '''not''' contain constructs such as: {{sxhl|2=zone|example.com. MX 0 foo.example.com. foo.example.com. CNAME host.example.com. host.example.com. A 192.0.2.1}} |Domains that are used in the [[SMTP]] MAIL and RCPT commands may not have a CNAME record.<ref name="RFC1123">{{cite web|url=https://tools.ietf.org/html/rfc1123#section-5.2.2|last=Braden|first=R.|date=October 1989|title=RFC1123 - MAIL - SMTP & RFC-822|access-date=23 July 2020}}</ref> In practice this may work, but can have different behavior with different mail servers, and can have undesired effects.<ref name="DJB_CNAME">{{cite web|url=http://cr.yp.to/im/cname.html|title=CNAME records in mail|last=Bernstein|first=D. J.|access-date=3 June 2011}}</ref>}} == DNAME record == A '''DNAME record''' or '''Delegation Name record''' is defined by {{IETF 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: {{sxhl|2=zone| 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 return no data because a DNAME is not a CNAME and there is no A record directly at ''foo''. However, a lookup 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 returned name not found. Lastly, a request for ''foobar.foo.example.com'' would be DNAME mapped and return 192.0.2.25. == ANAME record == Several managed DNS platforms implement a non-standard ALIAS<ref>{{cite web |url=https://support.dnsimple.com/articles/alias-record/ |title=ALIAS Records |access-date=2019-07-26}}</ref> or ANAME<ref>{{cite web |url=https://dnsmadeeasy.com/services/anamerecords |title=ANAME Records |access-date=2022-09-24}}</ref> 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 were submitted for standardization,<ref name="ietf-aname">{{cite web|url=https://tools.ietf.org/html/draft-ietf-dnsop-aname-04|title=Address-specific DNS aliases (ANAME)|date=2019-07-08|access-date=2019-07-26}}</ref> 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. The main advantage of ANAME records over CNAME records is that they can be used on a [[zone apex]], while a standards-following resolver will not treat domain names with CNAME records as a zone apex.<ref>{{cite web |last1=Goldlust |first1=Suzanne |last2=Almond |first2=Cathy |title=CNAME at the apex of a zone |url=https://kb.isc.org/docs/aa-01640 |website=ISC's Open Source Knowledgebase |publisher=Internet Systems Consortium |access-date=8 April 2023 |ref=isc_aa-01640}}</ref> Also, while a DNS client requires at least two queries to resolve a CNAME to an A record to an IP address, an 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 resolve the query faster. The ANAME record type was submitted as a draft standard to IETF. However, the latest draft document expired in January 2020<ref name="ietf-aname"/> and has been superseded by a series of proposals, the most recent of which is the one for the SVCB and HTTPS record types.<ref>{{cite web |first1=B. |last1=Schwartz |first2=M. |last2=Bishop |first3=E. |last3=Nygren|title=Service binding and parameter specification via the DNS (DNS SVCB and HTTPS RRs) |url=https://datatracker.ietf.org/doc/html/draft-ietf-dnsop-svcb-https|date=2023-03-11|access-date=2023-04-08}}</ref> == See also == * [[List of DNS record types]] * [[Internet Assigned Numbers Authority]] * [[ICANN]] ==References== {{Reflist}} == External links == * {{IETF RFC|2219|link=no}} – Use of DNS Aliases for Network Services [[Category:DNS record types]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite web
(
edit
)
Template:For
(
edit
)
Template:IETF RFC
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Sxhl
(
edit
)
Template:Unordered list
(
edit
)