使用的时候,CNAME解析的时候生效比较慢,而A Record非常快。
这两种方式都可以进行子域名的解析。
CName vs. A Record
Web sites are stored in locations that are uniquely identified by a group of numbers, which we know as IP addresses; but to access these sites, we usually type in their corresponding domain names, that are easier to remember. To get the correct IP address, your browser will contact a Domain Name Server, or DNS, and query its database for the IP address. An A Record is a type of resource record that directly points to the IP address. A CName, or Canonical Name record, is also a resource record, but it does not point to an IP address. Instead, it points to another domain address.
Although the point of having a DNS is to get the IP address of a given domain, a CName record is used to identify multiple domain names that point to the same IP address. There are a lot of uses for CName records, but the most prominent is when using multiple services that are running on the same machine or host. An FTP server will have a domain name of ftp.example.com, while an http server will use www.example.com. Despite this, they will be using the same IP address. Therefore, a CName entry will also exist in the database for ftp.example.com, that points to www.example.com. When looking for the IP address of ftp.example.com, the CName record is encountered, and the query is restarted using the new domain name. This procedure is repeated until an A Record is found that provides the IP address being searched. This way, only a single A Record that points to the right IP address is needed.
A CName record is very useful, but it can also create a problem that is systemic to its design. Given the example domain names provided above, it is possible that two CName records exist, where ftp points to www for the first, and the reverse for the second entry. As the query is restarted once a CName entry is found, having those two entries will result in an infinite loop that could crash the server. A Records do not have this problem, as they do not point to another domain name.
Summary:
1. A CName points to a domain name, while an A Record points to an IPv4 address.
2. Finding a CName record will spawn a new search, while finding an A Record will not.
3. Improper CName records can result in an endless loop, but A Records do not.
Posted by ian at 23:40
这两种方式都可以进行子域名的解析。
CName vs. A Record
Web sites are stored in locations that are uniquely identified by a group of numbers, which we know as IP addresses; but to access these sites, we usually type in their corresponding domain names, that are easier to remember. To get the correct IP address, your browser will contact a Domain Name Server, or DNS, and query its database for the IP address. An A Record is a type of resource record that directly points to the IP address. A CName, or Canonical Name record, is also a resource record, but it does not point to an IP address. Instead, it points to another domain address.
Although the point of having a DNS is to get the IP address of a given domain, a CName record is used to identify multiple domain names that point to the same IP address. There are a lot of uses for CName records, but the most prominent is when using multiple services that are running on the same machine or host. An FTP server will have a domain name of ftp.example.com, while an http server will use www.example.com. Despite this, they will be using the same IP address. Therefore, a CName entry will also exist in the database for ftp.example.com, that points to www.example.com. When looking for the IP address of ftp.example.com, the CName record is encountered, and the query is restarted using the new domain name. This procedure is repeated until an A Record is found that provides the IP address being searched. This way, only a single A Record that points to the right IP address is needed.
A CName record is very useful, but it can also create a problem that is systemic to its design. Given the example domain names provided above, it is possible that two CName records exist, where ftp points to www for the first, and the reverse for the second entry. As the query is restarted once a CName entry is found, having those two entries will result in an infinite loop that could crash the server. A Records do not have this problem, as they do not point to another domain name.
Summary:
1. A CName points to a domain name, while an A Record points to an IPv4 address.
2. Finding a CName record will spawn a new search, while finding an A Record will not.
3. Improper CName records can result in an endless loop, but A Records do not.
Posted by ian at 23:40
本文详细解释了CNAME与A记录在DNS解析中的作用与区别,包括它们如何帮助子域名解析,以及各自的优势与潜在问题。通过对比,帮助读者了解如何合理选择并配置DNS记录以优化网站性能。

被折叠的 条评论
为什么被折叠?



