Jump to content

CNAME record

From Wikipedia, the free encyclopedia

Template:Short description Template:CS1 config Template:Use list-defined references Template:Use mdy dates Template:For A CNAME record (for Canonical NAME) is a type of resource record in the Domain Name System (DNS) that maps one domain name (the alias) to another (the canonical name).Template:R

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 Template:Mono records to point Template:Var and Template:Var to the DNS entry for Template:Var, 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 Template:Mono record for Template:Var.

Template:Mono records must always point to another domain name, never directly to an IP address.

Details

DNS Template:Mono records are specified in RFC 1034[1] and clarified in Section 10 of RFC 2181.[2]

CNAME records are handled specially in the domain name system and have several restrictions on their use. When a DNS resolver encounters a Template:Mono 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 Template:Mono records, the canonical name (righthand side) is returned, rather than restarting the query. The canonical name that a Template:Mono record points to can be anywhere in the DNS, whether local or on a remote server in a different DNS zone.

<syntaxhighlight lang="zone" style="float: right; margin: 0 0 1em 1.5em; width: fit-content;"> $ORIGIN example.com. […] bar.example.com. 3600 IN CNAME foo.example.com. foo.example.com. 3600 IN A 192.0.2.23 </syntaxhighlight> Consider the DNS zone shown at right: when an Template:Mono record lookup for Template:Var is carried out, the resolver will see a Template:Mono record and restart the lookup for Template:Var, eventually returning Template:Mono.

Possible confusion

With a CNAME record, one can point a name such as Template:Var to Template:Var. Because of this, during casual discussion, the lefthand (Template:Var) side of a DNS entry can be incorrectly identified as the Template:Mono, however, this is inaccurate. The Template:Mono record stores the canonical (true) name of a host, making the righthand side the actual Template:Mono.

<syntaxhighlight lang="zone" style="float: right; margin: 0 0 1em 1.5em; width: fit-content;"> bar.example.com. 3600 IN CNAME foo.example.com. </syntaxhighlight> 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.Template:R In other words, consider the Template:Mono record shown at right. This may be read as saying that Template:Var is an alias for the canonical name Template:Var. A client will request Template:Var and the answer will be Template:Var.

Constraints

  • Template:Mono records must always be pointed to another domain name, never to an IP address.
  • If a Template:Mono 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.Template:R[3] The exception is when DNSSEC is in use, in which case there can be DNSSEC-related records such as Template:Mono, Template:Mono, etc.Template:R
  • Template:Mono records that point to other Template:Mono records should be avoided due to their lack of efficiency, but are not an error.[1] It is possible, then, to create unresolvable loops with Template:Mono records, as in:<syntaxhighlight lang="zone" style="margin-left: 0.4rem; width: fit-content;">

$ORIGIN example.com. […] foo.example.com. 3600 IN CNAME bar.example.com. bar.example.com. 3600 IN CNAME foo.example.com. </syntaxhighlight>

  • RFC 1034 also makes the presence of an [[SOA record|Template:Mono record]] at the zone apex an additional requirement,Template:R presenting yet another barrier to placing a Template:Mono record appearing at the zone apex.
  • Template:Clarify
  • [[MX record|Template:Mono]] and [[List of DNS record types#NS|Template:Mono records]] must never point to a Template:Mono alias.Template:R So, for example, a zone must not contain constructs such as:<syntaxhighlight lang="zone" style="margin-left: 0.4rem; width: fit-content;">

$ORIGIN example.com. @ 3600 IN SOA ns1.example.com. [email protected] (

                                                   zone-admin.example.com.
                                                   […]                             )

@ 2400 IN MX 0 foo.example.com. foo.example.com. 3600 IN CNAME host.example.com. host.example.com. 3600 IN A 192.0.2.1 </syntaxhighlight>

DNAME record

A Template:Mono record (for Delegation NAME) is defined by RFC 6672[6] (the earlier RFC 2672[7] now being obsolete). The Template:Mono 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 Template:Mono record creates an alias for a single name and not its subdomains. Like the Template:Mono record, the DNS lookup will continue by retrying the lookup with the new name. The name server synthesizes a Template:Mono record to actually apply the Template:Mono record to the requested name—Template:Monos for every node on a subtree have the same effect as a Template:Mono for the entire subtree. <syntaxhighlight lang="zone" style="float: right; margin: 0 0 0.5em 1.5em; width: fit-content;"> $ORIGIN example.com. […] foo.example.com. 1200 IN DNAME bar.example.com. bar.example.com. 3600 IN A 192.0.2.23 xyzzy.bar.example.com. 3600 IN A 192.0.2.24

  • .bar.example.com. 3600 IN A 192.0.2.25

</syntaxhighlight>

For example, if there is a DNS zone as seen at right, an Template:Mono record lookup for Template:Var will return no data because a Template:Mono is not a Template:Mono, and there is no Template:Mono record defined for the <syntaxhighlight lang="text" class="" style="" inline="1">foo</syntaxhighlight> host.

However, a lookup for Template:Var will be Template:Mono mapped and return the Template:Mono record for Template:Var, which is Template:Mono; if the Template:Mono record had been a Template:Mono record, this request would have returned name not found.

Lastly, a request for Template:Var would be Template:Mono mapped and return Template:Mono.

ANAME record

Several managed DNS platforms implement a non-standard Template:Mono[8] or Template:Mono[9] record type. These pseudo records are managed by DNS administrators like Template:Mono records, but are published and resolved by (some) DNS clients like Template:Mono records. Template:Mono records are typically configured to point to another domain, but when queried by a client, answer with an IP address. While Template:Mono record types were 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.

The main advantage of Template:Mono records over Template:Mono records is that they can be used on a zone apex, while a standards-following resolver will not treat domain names with Template:Mono records as a zone apex.[11] Also, while a DNS client requires at least two queries to resolve a Template:Mono to an Template:Mono record to an IP address, an Template:Mono will shift the second and subsequent query to the server. If the DNS server can resolve the Template:Mono 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 Template:Mono record type was submitted as a draft standard to the IETF Domain Name System Operations (DNSOP) working group, however its most recent revision expired in January 2020,[10] having not found the consensus needed for a proposal. It has since been superseded by a series of drafts for two other new record types that resulted in RFC 9460, titled "Service Binding and Parameter Specification via the DNS (Template:Mono and Template:Mono Resource Records)," being approved as a Proposed Standard in November 2023.[12]

See also

References

  1. ↑ 1.0 1.1 Template:Cite IETF
  2. ↑ Template:Cite IETF
  3. ↑ Template:Cite IETF
  4. ↑ Template:Cite IETF
  5. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  6. ↑ Template:Cite IETF
  7. ↑ Template:Cite IETF
  8. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  9. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  10. ↑ 10.0 10.1 Template:Cite IETF
  11. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  12. ↑ Template:Cite IETF

Further reading