CNAME Resolution
Canonical Name (CNAME) resolution points the current domain name to another domain name instead of an IP address, enabling flexible delegation of domain name resolution. This way, users can easily access cloud services such as CDN without frequently changing their DNS configurations, greatly simplifying the O&M process and improving service flexibility.
Why CNAME Resolution?
On the Internet, websites and applications are typically accessed through domain names. However, mapping domain names directly to IP addresses complicates management and maintenance, especially across multiple servers and environments. CNAME resolution simplifies domain name management by pointing one domain name to another, improving flexibility and maintainability. For example, changing a server's IP address only requires updating the domain's A record, leaving related CNAME records untouched. This reduces maintenance overhead and minimizes the risk of configuration errors.
At the early stage of enterprise website operations, administrators typically use A records to directly map domain names to server IP addresses. However, when services such as CDN acceleration are required, the service provider usually provides another domain name (for example, the CNAME domain name provided by CDN). The IP address corresponding to this domain name dynamically changes based on the load and network conditions.
Using A records requires administrators to manually monitor and frequently update IP configurations. This often leads to service downtime if updates are delayed. CNAME resolution addresses this issue by pointing a domain name to an alias provided by the service provider. This way, the subsequent resolution is handled by the authoritative DNS server of the service provider. CNAME resolution makes IP address changes transparent to users and ensures that traffic is routed in real time according to the service provider's optimal scheduling policies.
Advantages
- Decoupled O&M: Users only need to maintain the alias, without worrying about the specific IP address changes. This greatly simplifies domain name management and reduces the risk of configuration errors.
- Inherited scheduling: CNAME resolution automatically inherits the resolution policies of the target domain name (such as intelligent scheduling provided by CDN), enabling your domain name to immediately support load balancing and nearby access.
- Flexible configuration: By allowing seamless switching to service provider aliases, CNAME resolution streamlines multi-cloud traffic routing and DR switchovers, significantly enhancing system agility.
Application Scenarios
1. CDN acceleration: Website O&M teams face challenges such as high cross-region access latency and significant bandwidth pressure on origin servers. O&M personnel configure the service domain name as a CNAME record at the DNS service provider, pointing it to the acceleration domain name provided by the CDN service provider. This operation automatically routes website traffic to the CDN network, allowing static resources to be cached and distributed from PoPs to significantly improve page load speeds.
2. Security configuration: Financial or e-commerce platforms face DDoS attacks and need to hide origin server IP addresses by routing traffic through an Advanced Anti-DDoS service. Security engineers achieve this by pointing the service domain name's CNAME record to the anti-DDoS provider's domain alias. In this case, all traffic is routed through a scrubbing center where malicious traffic is filtered out, while legitimate requests are forwarded to the origin server. This effectively ensures service continuity and data security.
3. Global load balancing: International enterprises need to enable nearby access for global users, but a single IP address cannot meet the requirements of multi-region coverage. To address this issue, architects use a CNAME record to point the primary domain name to the global server load balancing (GSLB) domain name. Based on the user's continent or country, the system automatically resolves the domain to the nearest local service cluster, enabling intelligent global traffic routing and disaster recovery.
How CNAME Resolution Works
Input: A user accesses a website or application using a domain name, triggering a DNS resolution request.
Key steps:
- DNS resolution: The DNS resolution module maps the requested domain to the target domain specified by the CNAME record.
- Target domain resolution: The domain management module resolves the target CNAME domain into its corresponding IP address.
- Load balancing: The load balancing module evaluates the target IP address and selects the optimal server to route user requests.
Key mechanism: CNAME records are used to point multiple domains to the same target domain, simplifying domain management while improving system flexibility and maintainability.
Output: User requests are correctly routed to the optimal server, maximizing website performance, access speed, and application stability.
Related Operations and Features
- Configure CNAME resolution for CDN acceleration domain names: Adding a CNAME Record on Huawei Cloud DNS.
- Connect a domain name to CDN for acceleration: Getting Started with CDN.