1. DNS/1/資源レコード/CNAME
Contents
1.1. RFC 1035
RFC 1035 より
3.3.1. CNAME RDATA format
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / CNAME / / / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ where: CNAME A <domain-name> which specifies the canonical or primary name for the owner. The owner name is an alias.
CNAME RRs cause no additional section processing, but name servers may choose to restart the query at the canonical name in certain cases. See the description of name server logic in [RFC-1034] for details.
CNAME RRs は付加節処理は引きおこさない。
- 正規名に対しての検索を起動してもよい。(RFC 1034参照)
1.2. 1034
Most of these systems have a notion that one of the equivalent set of names is the canonical or primary name and all others are aliases.
The domain system provides such a feature using the canonical name (CNAME) RR. A CNAME RR identifies its owner name as an alias, and specifies the corresponding canonical name in the RDATA section of the RR.
If a CNAME RR 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. This rule also insures that a cached CNAME can be used without checking with an authoritative server for other RR types.
CNAME RRs cause special action in DNS software.
When a name server fails to find a desired RR in the resource set associated with the domain name, it checks to see if the resource set consists of a CNAME record with a matching class. If so, the name server includes the CNAME record in the response and restarts the query at the domain name specified in the data field of the CNAME record. The one exception to this rule is that queries which match the CNAME type are not restarted.
...
Both of these RRs would be returned in the response to the type A query, while a type CNAME or * query should return just the CNAME.
4.3.2. Algorithm から
3. Start matching down, label by label, in the zone. The matching process can terminate several ways: a. If the whole of QNAME is matched, we have found the node. If the data at the node is a CNAME, and QTYPE doesn't match CNAME, copy the CNAME RR into the answer section of the response, change QNAME to the canonical name in the CNAME RR, and go back to step 1. Otherwise, copy all RRs which match QTYPE into the answer section and go to step 6.
1.3. RFC 2181
Note that the answer section of an authoritative answer normally contains only authoritative data.
However when the name sought is an alias (see section 10.1.1) only the record describing that alias is necessarily authoritative.
Clients should assume that other records may have come from the server's cache. Where authoritative answers are required, the client should query again, using the canonical name associated with the alias.