首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Azure反向DNS不可能用于动态IP?

问Azure反向DNS不可能用于动态IP?
EN

Stack Overflow用户
提问于 2020-06-25 07:18:52
回答 1查看 564关注 0票数 1

我正在运行一个爱好邮件服务器下的Azure免费层。

一项要求是使IP的反向DNS匹配主机名,否则激进的反垃圾邮件服务器将拒绝来自我的邮件服务器(如gmail)的消息。

在https://learn.microsoft.com/en-us/azure/dns/dns-reverse-dns-for-azure-services中,它指出(我的重点)

代码语言:javascript
复制
The DNS name for the PublicIpAddress, contosoapp1.northus.cloudapp.azure.com
The DNS name for a different PublicIpAddress in the same subscription, such as contosoapp2.westus.cloudapp.azure.com
A vanity DNS name, such as app1.contoso.com, so long as this name is first configured as a CNAME to contosoapp1.northus.cloudapp.azure.com, or to a different PublicIpAddress in the same subscription.
A vanity DNS name, such as app1.contoso.com, **so long as this name is first configured as an A record** to the IP address 23.96.52.53, or to the IP address of a different PublicIpAddress in the same subscription.

我通过nslookup验证了A记录是否正确地将FQDN解析为所讨论的IP。

但是,当按照指示执行时-我会收到以下错误消息:

代码语言:javascript
复制
ErrorMessage: 
ReverseFqdn [[mydomain]]. that PublicIPAddress [[IP resource name]] is trying to use does not belong to subscription [[removed]]. 
One of the following conditions need to be met to establish ownership: 
1) ReverseFqdn matches fqdn of any public ip resource under the subscription; 
2) ReverseFqdn resolves to the fqdn (through CName records chain) of any public ip resource under the subcription; 
3) It resolves to the ip address (through CName and A records chain) of a static public ip resource under the subscription.

注意,错误消息与文档略有不同--即只有在涉及静态IP的情况下才可能使用"A“记录方法。我也尝试过将IP设置为“静态”,它确实开始工作了。然而,静态IP是可收费的,因此这将违背爱好邮件服务器的目的,因此不能作为进行中的选择。

是MS文档错了,还是我错过了设置反向DNS?的一步?

补充信息

复制错误消息的步骤

1.核实记录是否正确

nslookup域

输出-显示我的VM的IP。

所以"A“记录正确解析。

2.尝试在反向DNS时设置

(这基本上就是上面文档链接中的步骤)

代码语言:javascript
复制
$pip = Get-AzPublicIpAddress -ResourceGroupName "Mail_in_a_Box"
$pip.DnsSettings = New-Object -TypeName "Microsoft.Azure.Commands.Network.Models.PSPublicIpAddressDnsSettings"
$pip.DnsSettings.DomainNameLabel = "mydomainlabel"
$pip.DnsSettings.ReverseFqdn = "mydomainname"
Set-AzPublicIpAddress -PublicIpAddress $pip

  1. 将IP类型更改为静态

将下面的行添加到上面的块将允许设置反向DNS (但不是我想要的!)

代码语言:javascript
复制
$pip.PublicIpAllocationMethod = "Static"
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-06-26 07:07:25

在我的验证之后,不需要将IP分配方法更改为静态。正确的命令如下:

代码语言:javascript
复制
$pip = Get-AzPublicIpAddress -Name "PublicIp" -ResourceGroupName "MyResourceGroup"
$pip.DnsSettings = New-Object -TypeName "Microsoft.Azure.Commands.Network.Models.PSPublicIpAddressDnsSettings"
$pip.DnsSettings.DomainNameLabel = "contosoapp1"
$pip.DnsSettings.ReverseFqdn = "contosoapp1.westus.cloudapp.azure.com."
Set-AzPublicIpAddress -PublicIpAddress $pip

请注意,您只能在FQDN中选择DomainNameLabel。当公共IP地址分配给Azure门户中的网络接口时,它属于某个区域。FQDN应该与somednslabel.region.cloudapp.azure.com.这样的公共IP资源区域相匹配

如果我只是任意地键入ReverseFqdn,它将复制错误消息。请检查您是否输入了正确的ReverseFqdn。

​

​

更新

验证之后,您可以使用CNAME记录作为错误消息中的条件2。如果使用A记录,则需要静态公共IP资源。

代码语言:javascript
复制
2) ReverseFqdn resolves to the fqdn (through CName records chain) of any public IP resource under the subscription; 

步骤:

  1. 创建默认的天青,提供像qaz.eastus.cloudapp.azure.com.一样的公共IP地址作为上面的命令.

  1. 创建CNAME记录,将您的自定义主机名指向DNS区域中的此FQDN。在我的示例中,我使用Azure DNS区域。

  1. 在ReverseFqdn中添加自定义主机名。

$pip = Get-AzPublicIpAddress -Name "ubun-pip" -ResourceGroupName "nancytest"

$pip.DnsSettings.ReverseFqdn = "nancytest.domain.com"

Set-AzPublicIpAddress -PublicIpAddress $pip

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62569909

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档