How to create a PTR record?

Santiago Forero 1 Reputation point
2021-09-23T16:06:09.07+00:00

Hello, I have a VM on azure with a static IP address and a domain.

I need to make a PTR record that points my VM's address to my domain (forero.xyz)

How do I do it?

I have created a DNS Zone like this: https://i.imgur.com/jtkqmUH.png
Should I do anything else?

Azure DNS
Azure DNS
An Azure service that enables hosting Domain Name System (DNS) domains in Azure.
593 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. GitaraniSharma-MSFT 47,316 Reputation points Microsoft Employee
    2021-10-01T13:13:05.043+00:00

    Hello @Santiago Forero ,

    The below doc explains how to host reverse DNS lookup zones in Azure DNS which means you can host reverse DNS lookup zones for your ISP-assigned IP blocks on Azure DNS.
    https://learn.microsoft.com/en-us/azure/dns/dns-reverse-dns-hosting

    But if your requirement is to configure reverse DNS (PTR records) for services hosted in Azure (compute resources such as virtual machines, virtual machine scale sets, and Service Fabric clusters having Public IP addresses), then you need to refer the below article:
    https://learn.microsoft.com/en-us/azure/dns/dns-reverse-dns-for-azure-services

    Services in Azure use IP addresses assigned by Azure and owned by Microsoft. These reverse DNS records (PTR records) must be created in the corresponding Microsoft-owned reverse DNS lookup zones.

    As explained in this doc, Azure only allows the creation of a reverse DNS record where domain name specified in the reverse DNS record is the same as, or resolves to, the DNS name or IP address of a PublicIpAddress or Cloud Service in the same Azure subscription.

    For example: Suppose the PublicIpAddress resource has the DNS name xyz.northus.cloudapp.azure.com and IP address 23.96.52.53. The ReverseFqdn for the PublicIpAddress can be specified as:

    • The DNS name for the PublicIpAddress, xyz.northus.cloudapp.azure.com
    • The DNS name for a different PublicIpAddress in the same subscription, such as xyz2.westus.cloudapp.azure.com
    • A vanity DNS name or a custom DNS name, such as xyz.contoso.com, so long as this name is first configured as a CNAME to xyz.northus.cloudapp.azure.com, or to a different PublicIpAddress in the same subscription.
    • A vanity DNS name or a custom DNS name, such as xyz.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.

    You can configure reverse DNS for PublicIpAddress resources in the Resource Manager deployment model, using either Azure PowerShell, Azure classic CLI, or Azure CLI. Configuring reverse DNS for PublicIpAddress resources is not currently supported via the Azure portal.

    To add reverse DNS to an existing PublicIpAddress, you need to make sure that the Public IP address has a DNS name.

    Detailed steps:

    I have a custom domain "msazurelabs.tk" and wanted to use this domain to setup as a reverse DNS for my Azure VM's static Public IP, so below are the detailed steps that I followed in my own lab to configure a custom reverse DNS and you can refer the same:

    1) First add a DNS label for the Public IP address for which you want to create a PTR record. You can do this either via Azure portal or using the PowerShell commands:

    136978-image.png

    2) Once the DNS name of the Public IP address is configured and replicated, you will have to go to your DNS provider where your custom domain is and create an A record for the custom DNS to point to the Public IP address or a CNAME record pointing to the Public IP’s DNS name as below:

    137051-image.png

    3) Once the A record or CNAME record is configured & replicated, you can go ahead and set Reverse DNS as follows using the below Azure PowerShell commands:

    $pip = Get-AzPublicIpAddress -Name "VM2PublicIP" -ResourceGroupName "Training-Lab"
    $pip.DnsSettings.ReverseFqdn = "msazurelabs.tk"
    Set-AzPublicIpAddress -PublicIpAddress $pip

    It should execute successfully and give the following output:

    Name : vm2publicip
    ResourceGroupName : Training-Lab
    Location : eastus
    ProvisioningState : Succeeded
    Tags :
    PublicIpAllocationMethod : Static
    IpAddress : 52.168.167.212
    PublicIpAddressVersion : IPv4
    IdleTimeoutInMinutes : 4
    IpConfiguration : {
    "Id": "/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/Training-Lab/providers/Microsoft.Network/networkInterfaces/vm2269/ipConfigurations/ipconfig1"
    }
    DnsSettings : {
    "DomainNameLabel": "msazurelabs",
    "Fqdn": "msazurelabs.eastus.cloudapp.azure.com",
    "ReverseFqdn": "msazurelabs.tk"

    }
    Zones : {}
    Sku : {
    "Name": "Basic",
    "Tier": "Regional"
    }
    IpTags : []
    ExtendedLocation : null

    NOTE: It may take some time to replicate the settings and then you can verify the same using Digwebinterface as below.

    137061-image.png

    Kindly let us know if the above helps or you need further assistance on this issue.


    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    6 people found this answer helpful.

  2. Andreas Baumgarten 96,266 Reputation points MVP
    2021-09-23T16:54:21.727+00:00

    Hi @Santiago Forero ,

    you created a reverse lookup zone already?

    Maybe this helps:
    https://learn.microsoft.com/en-us/azure/dns/dns-reverse-dns-hosting
    https://learn.microsoft.com/en-us/azure/dns/dns-reverse-dns-hosting#create-a-dns-ptr-record

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten