CNAME 记录
Embed This Widget
Add the script tag and a data attribute to embed this widget.
Embed via iframe for maximum compatibility.
<iframe src="https://ipfyi.com/iframe/glossary/cname-record/" width="420" height="400" frameborder="0" style="border:0;border-radius:10px;max-width:100%" loading="lazy"></iframe>
Paste this URL in WordPress, Medium, or any oEmbed-compatible platform.
https://ipfyi.com/glossary/cname-record/
Add a dynamic SVG badge to your README or docs.
[](https://ipfyi.com/glossary/cname-record/)
Use the native HTML custom element.
定义
创建从一个域名到另一个域名别名的DNS记录(例如:www.example.com -> example.com)。别名继承目标的所有DNS记录,但不能与同名的其他记录类型共存。
How CNAME Resolution Works
A CNAME record creates a DNS alias: it says "this name is another name for that name." When a resolver encounters a CNAME, it must follow the chain, resolving the target name until it reaches a final A RecordA DNS record that maps a domain name to an IPv4 address (e.g., example.com -> 93.184.216.34). The most fundamental DNS record type for resolving domain names to IP addresses. or AAAA RecordA DNS record that maps a domain name to an IPv6 address. Named "AAAA" (quad-A) because an IPv6 address is four times the size of an IPv4 address.. The record www.example.com CNAME example.com means a client resolving www.example.com will next resolve example.com to get the actual IP.
CNAME chains can span multiple hops — www.example.com to lb.example.net to 203.0.113.10 — but each hop adds latency if not cached. Best practice is to keep chains short (one or two hops maximum).
CNAME Restrictions
The apex (root) of a DNS zone cannot have a CNAME. example.com itself must use an A RecordA DNS record that maps a domain name to an IPv4 address (e.g., example.com -> 93.184.216.34). The most fundamental DNS record type for resolving domain names to IP addresses. because the zone apex must be able to serve SOA and NS records, and a CNAME would prohibit other record types at that name. To work around this for apex domains pointing to CDNs or load balancers with dynamic IPs, DNS providers offer proprietary extensions: Cloudflare CNAME flattening, AWS Route 53 ALIAS records, and similar mechanisms that resolve the CNAME internally and return A records to clients.
Practical Uses
CNAMEs are ubiquitous. CDNs issue customers a CNAME target (e.g., customer.cdn-provider.com) to point their www subdomain to CDN infrastructure — the CDN can then change the underlying IPs without requiring customers to update their DNS. Email providers use CNAME records to delegate DKIM signing subdomains. SaaS platforms use CNAMEs for custom domain support.
A CNAME cannot coexist with other record types at the same name (except DNSSEC records). If mail.example.com is a CNAME, you cannot also have an MX RecordMail Exchange record. A DNS record that specifies the mail server responsible for receiving email for a domain, along with a priority value that determines the order in which servers are tried. at that exact name.
Inspect CNAME chains with DNS Lookup.