Azure DNS - Domains Not Being Found By Public Internet

余生颓废 提交于 2019-12-13 02:06:13

问题


I've written a PowerShell script to create all the A/CNAME/MX records etc. for all my domain names.

It runs against my Azure subscription without an error.

I can go into the config section of my Azure Websites and map those domain names to my websites and it resolves the domains names correctly.

I've set the NamesServers at the registrar to the correct name servers that I'm getting back from

$zone = Get-AzureRmDnsZone –Name activistmanager.info –ResourceGroupName DNSRecords
Get-AzureRmDnsRecordSet –Name “@” –RecordType NS –Zone $zone

I can see that the domain names servers have the correct NameServers

But it doesn't work

Even using NSLOOKUP (after switching the server to the Azure DNS Servers)

I run

ls x.com

and it returns

Can't list the domain x.com:Non Existent domain
The DNS server refused to transfer the zone X.com to your computer
If This is incorrect, check the zone transfer security settings for X.com on the DNS

These zones we were resolving throughout the day as I was transferring them one by one to Azure but at some point they stopped working. What am I missing?

#---------------------------------------------------------------------------------------------
#freedomnstuff.org
#New-AzureRmDnsZone -Name freedomnstuff.org -ResourceGroupName DNSRecords
# A
$rs = New-AzureRmDnsRecordSet -Name "*" -RecordType A -ZoneName "freedomnstuff.org" -ResourceGroupName "DNSRecords" -Ttl 60 -Overwrite -Force          
Add-AzureRmDnsRecordConfig -RecordSet $rs -Ipv4Address 168.62.48.183
Set-AzureRmDnsRecordSet -RecordSet $rs -Overwrite

# CNAME

$rs = New-AzureRmDnsRecordSet -Name "awverify" -RecordType "CNAME" -ZoneName "freedomnstuff.org" -ResourceGroupName "DNSRecords" -Ttl 60 -Overwrite -Force
Add-AzureRmDnsRecordConfig -RecordSet $rs -Cname "awverify.freedomnstuff.azurewebsites.net"
Set-AzureRmDnsRecordSet -RecordSet $rs -Overwrite

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

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

回答1:


Ok, I've just spotted your problem!

You can't use a wildcard for the apex record.

A wildcard is for the domain record at *.example.com (notice the dot between the * and the domain) This will match something.example.com

The "@" prefix refers to the domain itself. so that will match example.com

When you make a CNAME and point it to example.com, the next look up is an A record for example.com and the wildcard domain doesn't match that. (you'd need to wild card *.com to make that match!)

Add this, and it should all work as expected...

$rs = New-AzureRmDnsRecordSet -Name "@" `
         -RecordType "A" `
         -ZoneName "freedomnstuff.org" `
         -ResourceGroupName "DNSRecords" `
         -Ttl 60 -Overwrite -Force

Add-AzureRmDnsRecordConfig -RecordSet $rs `
         -Ipv4Address 168.62.48.183

Set-AzureRmDnsRecordSet -RecordSet $rs -Overwrite


来源:https://stackoverflow.com/questions/34683328/azure-dns-domains-not-being-found-by-public-internet

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!