您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

教程:创建别名记录以引用区域资源记录Tutorial: Create an alias record to refer to a zone resource record

别名记录可引用相同类型的其他记录集。Alias records can reference other record sets of the same type. 例如,可以使 DNS CNAME 记录集成为相同类型的另一 CNAME 记录集的别名。For example, you can have a DNS CNAME record set be an alias to another CNAME record set of the same type. 如果要使部分记录集成为别名,部分成为有关行为的非别名,请使用此功能。This capability is useful if you want to have some record sets as aliases and some as non-aliases in terms of behavior.

本教程介绍如何执行下列操作:In this tutorial, you learn how to:

  • 为区域中的资源记录创建别名记录。Create an alias record for a resource record in the zone.
  • 测试别名记录。Test the alias record.

如果还没有 Azure 订阅,可以在开始前创建一个免费帐户If you don’t have an Azure subscription, create a free account before you begin.

先决条件Prerequisites

必须具有可用于在 Azure DNS 中托管以供测试的域名。You must have a domain name available that you can host in Azure DNS to test with. 必须能够完全控制此域。You must have full control of this domain. 完全控制包括能够为域设置名称服务器 (NS) 记录。Full control includes the ability to set the name server (NS) records for the domain.

有关在 Azure DNS 中托管域的说明,请参阅教程:在 Azure DNS 中托管域For instructions to host your domain in Azure DNS, see Tutorial: Host your domain in Azure DNS.

创建别名记录Create an alias record

创建指向区域中资源记录的别名记录。Create an alias record that points to a resource record in the zone.

创建目标资源记录Create the target resource record

  1. 选择 Azure DNS 区域以打开该区域。Select your Azure DNS zone to open the zone.
  2. 选择“记录集”。 Select Record set.
  3. 在“名称” 文本框中,输入“server” 。In the Name text box, enter server.
  4. 对于“类型” ,选择“A” 。For the Type, select A.
  5. 在“IP 地址” 文本框中,输入“10.10.10.10” 。In the IP ADDRESS text box, enter 10.10.10.10.
  6. 选择“确定” 。Select OK.

创建别名记录Create the alias record

  1. 选择 Azure DNS 区域以打开该区域。Select your Azure DNS zone to open the zone.
  2. 选择“记录集”。 Select Record set.
  3. 在“名称” 文本框中,输入“test” 。In the Name text box, enter test.
  4. 对于“类型” ,选择“A” 。For the Type, select A.
  5. 在“别名记录集”复选框中选择“是” 。 Select Yes in the Alias Record Set check box. 然后选择“区域记录集” 选项。Then select the Zone record set option.
  6. 对于“区域记录集” ,请选择“server” 记录。For the Zone record set, select the server record.
  7. 选择“确定” 。Select OK.

测试别名记录Test the alias record

  1. 启动最喜欢的 nslookup 工具。Start your favorite nslookup tool. 一种方法是浏览到 https://network-tools.com/nslook One option is to browse to https://network-tools.com/nslook.
  2. 设置 A 记录的查询类型并查找 test.<你的域名> 。Set the query type for A records, and look up test.<your domain name>. 答案为 10.10.10.10The answer is 10.10.10.10.
  3. 在 Azure 门户中,将 server A 记录更改为 10.11.11.11 。In the Azure portal, change the server A record to 10.11.11.11.
  4. 等待几分钟,然后将 nslookup 再次用于 test 记录。Wait a few minutes, and then use nslookup again for the test record. 答案为 10.11.11.11The answer is 10.11.11.11.

清理资源Clean up resources

不再需要为本教程创建的资源时,请在区域中删除 servertest 资源记录。When you no longer need the resources created for this tutorial, delete the server and test resource records in your zone.

后续步骤Next steps

在本教程中,你已创建可引用区域中的资源记录的别名记录。In this tutorial, you created an alias record to refer to a resource record within the zone. 若要了解 Azure DNS 和 Web 应用,请继续学习适用于 Web 应用的教程。To learn about Azure DNS and web apps, continue with the tutorial for web apps.