Azure DNS中的通配符和裸CNAME记录 [英] Wildcard and Naked CNAME records in Azure DNS

查看:39
本文介绍了Azure DNS中的通配符和裸CNAME记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将所有DNS服务迁移到Azure DNS.使用Powershell,我已经成功创建了CNAME记录,以使www.something.com解析为Azure网站-

I'm migrating all my DNS services to Azure DNS. Using Powershell I've managed to successfully create the CNAME record to get www.something.com to resolve to an Azure website-

$rs = New-AzureRmDnsRecordSet -Name "www" -RecordType "CNAME" -ZoneName "something.com" -ResourceGroupName "DNSRecords" -Ttl 60 -Overwrite -Force
Add-AzureRmDnsRecordConfig -RecordSet $rs -Cname "MySomethingAzureWebsite.azurewebsites.net"
Set-AzureRmDnsRecordSet -RecordSet $rs -Overwrite

但是如何为通配符和裸露的地址(例如,

But how to I create CNAME records for wildcard and naked addresses like

*.something.com或something.com

*.something.com or something.com

我假设这与

New-AzureRmDnsRecordSet-名称"www"

但是,通过所有文档和Internet示例,我似乎找不到正确的措辞.

But through all the documentation and Internet examples I can't seem to find the right verbiage.

推荐答案

您遇到的问题是

The problem you're having is an issue with the rules of DNS, which forbid a CNAME record where another record exists. The naked address (or Apex) example.com already has two records (the SOA and NS) so a CNAME is not allowed.

如果节点上存在CNAME RR,则不应再有其他数据展示;这样可以确保规范名称及其别名的数据不能不同.此规则还确保可以将缓存的CNAME无需向权威服务器检查其他RR类型即可使用.

If a CNAME RR is present at a node, no other data should be present; this ensures that the data for a canonical name and its aliases cannot be different. This rule also insures that a cached CNAME can be used without checking with an authoritative server for other RR types.

为了创建Apex记录(即example.com),您需要使用A记录,这意味着它需要指向Azure网站的IP.有了该名称后,您就可以从www到example.com创建一个CNAME.(这是受支持的方法-您用于Azure网站的IP地址是静态的)

In order to create an Apex record, i.e. example.com you need to use an A record, which means it needs to point to the IP of your Azure website. Once you have that you can then create a CNAME from www to example.com. (this is the supported method - your IP Address for Azure websites is static)

您要查找的命令将类似于

the command you are looking for, would be something like

$rs = New-AzureRmDnsRecordSet -Name "@" -RecordType A `
       -ZoneName example.com -ResourceGroupName $RG `
       -Ttl $ttl -Force -Overwrite
Add-AzureRmDnsRecordConfig -RecordSet $rs -Ipv4Address $IPAddress
Set-AzureRmDnsRecordSet -RecordSet $rs -Overwrite

然后

$rs = New-AzureRmDnsRecordSet -Name "www" -RecordType "CNAME" `
      -ZoneName "something.com" -ResourceGroupName "DNSRecords" `
      -Ttl 60 -Overwrite -Force
Add-AzureRmDnsRecordConfig -RecordSet $rs -Cname "example.com"
Set-AzureRmDnsRecordSet -RecordSet $rs -Overwrite

这将创建您的区域顶点记录,并将www cname指向它,从而使example.com和www.example.com指向同一位置.

This will create your zone apex record and point the www cname to it making example.com and www.example.com point to the same place.

对于通配符,您将Apex"@"替换为星号"*",例如

For a Wildcard you replace the Apex "@" with an asterix "*" so something like

$rs = New-AzureRmDnsRecordSet -Name "*" -RecordType A `
       -ZoneName example.com -ResourceGroupName $RG `
       -Ttl $ttl -Force -Overwrite
#You know the rest

这篇关于Azure DNS中的通配符和裸CNAME记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆