What is an A Record vs CName

使用的时候,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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值