|
| 1 | +--- |
| 2 | +title: Create and manage reverse DNS zones in Azure Private DNS |
| 3 | +description: Learn how to use Azure Private DNS to create reverse DNS lookup zones for your private IP address ranges. |
| 4 | +author: greg-lindsay |
| 5 | +ms.service: dns |
| 6 | +ms.topic: how-to |
| 7 | +ms.date: 03/22/2024 |
| 8 | +ms.author: greglin |
| 9 | +--- |
| 10 | + |
| 11 | +# Create and manage reverse DNS zones in Azure Private DNS |
| 12 | + |
| 13 | +In this article, you learn how to create a private reverse lookup DNS zone and add pointer (PTR) records to the zone using the Azure portal. |
| 14 | + |
| 15 | +## What is reverse DNS? |
| 16 | + |
| 17 | +Reverse DNS (as the name indicates) is the opposite process to forward DNS. Reverse enables you to resolve an IP address to a name (for example: 10.1.2.5 --> myvm.contoso.com), whereas forward DNS resolves a name to an IP address. Azure Private DNS supports both IPv6 and IPv4 reverse DNS. |
| 18 | + |
| 19 | +### IPv6 reverse DNS |
| 20 | + |
| 21 | +IPv6 reverse DNS zones use the special domain **ip6.arpa**. For more information about IPv6 reverse zones and records, see the IPv6 sections that describe [creating an IPv6 reverse zone](dns-reverse-dns-hosting.md#ipv6) and [adding an IPv6 reverse DNS record](dns-reverse-dns-hosting.md#ipv6-1) in the [Host reverse DNS lookup zones in Azure DNS](dns-reverse-dns-hosting.md) article for public DNS. Azure Private DNS also supports IPv6 reverse DNS zones under the [requirements and restrictions](#requirements-and-restrictions) described in this article. |
| 22 | + |
| 23 | +### IPv4 reverse DNS zones |
| 24 | + |
| 25 | +IPv4 reverse DNS zones contain pointer (PTR) records and use the reserved domain name: **in-addr.arpa**. These reverse DNS zones follow a hierarchical naming pattern. For example: |
| 26 | + |
| 27 | +- **10.in-addr.arpa** contains all PTR records for IPv4 addresses in the 10.0.0.0/8 address space. |
| 28 | +- **1.10.in-addr.arpa** contains all PTR records for IPv4 addresses in the 10.1.0.0/16 address space. |
| 29 | +- **2.1.10.in-addr.arpa** contains only PTR records for IPv4 addresses in the 10.1.2.0/24 address space. |
| 30 | + |
| 31 | +Private IPv4 reverse DNS zones are intended for use with private IP address space as defined in [RFC 1918](https://www.rfc-editor.org/info/rfc1918). |
| 32 | + |
| 33 | +### IPv4 reverse DNS records |
| 34 | + |
| 35 | +To create an IPv4 reverse DNS record in your zone, add the remaining IP address octets in reverse order into the appropriate in-addr.arpa zone and provide a fully qualified domain name value (also called a **ptrdname**). The number of remaining IP address octets depend on the scope of the reverse DNS zone. For example: |
| 36 | + |
| 37 | +* 10.1.2.5 in the 10.in-addr.arpa zone appears as: `5.2.1 IN PTR myvm.contoso.com.` |
| 38 | +* 10.1.2.5 in the 1.10.in-addr.arpa zone appears as:`5.2 IN PTR myvm.contoso.com.` |
| 39 | +* 10.1.2.5 in the 2.1.10.in-addr.arpa zone appears as:`5 IN PTR myvm.contoso.com.` |
| 40 | + |
| 41 | +> [!IMPORTANT] |
| 42 | +> A reverse DNS zone for address space with a longer prefix takes precendence. For example, if all three zones contain entries for the IPv4 address 10.1.2.5 as shown here, only the entry in the 2.1.10.in-addr.arpa zone will be used. If the longer prefix zone (2.1.10.in-addr.arpa) exists, then all reverse DNS entries for the corresponding /24 address space must be entered in this zone. |
| 43 | +
|
| 44 | +## Requirements and restrictions |
| 45 | + |
| 46 | +- [Autoregistration](private-dns-autoregistration.md) isn't supported for reverse DNS. |
| 47 | +- A [virtual network link](private-dns-virtual-network-links.md) from the reverse zone is required to enable DNS resolution of PTR records. The process of [adding a virtual network link](#add-a-virtual-network-link) is demonstrated in this article. This is different from reverse DNS for public IP addresses, which don't require a virtual network link. |
| 48 | + - You can also forward DNS queries to a DNS resolver if the reverse zone is linked to the resolver's VNet. |
| 49 | +- Reverse zones must follow the naming guidelines described in this article and in [RFC 3172](https://www.rfc-editor.org/info/rfc3172). |
| 50 | + |
| 51 | +## Create a reverse lookup DNS zone |
| 52 | + |
| 53 | +1. Sign in to the [Azure portal](https://portal.azure.com). |
| 54 | +2. Select **Create a resource**, search for and select **Private DNS zones**, then select **+ Create**. |
| 55 | +3. On the **Create DNS zone** page, select, or enter the following settings: |
| 56 | + |
| 57 | + | Setting | Details | |
| 58 | + | --- | --- | |
| 59 | + | **Subscription** | Select your subscription.| |
| 60 | + | **Resource group** | Select or create a new resource group. | |
| 61 | + | **Name** | Enter a name for the DNS zone. In this example, the class C reverse DNS zone name **2.1.10.in-addr.arpa** is used. | |
| 62 | + | **Location** | Select the location for the resource group. The location is already be selected if you're using a previously created resource group. | |
| 63 | + |
| 64 | + See the following example: |
| 65 | + |
| 66 | +  |
| 67 | + |
| 68 | +4. Select **Review create**, and then select **Create**. |
| 69 | + |
| 70 | +## Create a DNS PTR record |
| 71 | + |
| 72 | +1. Select **+ Record set** to open the **Add record set** pane. |
| 73 | +2. As described previously in this article, PTR records in a class C reverse DNS zone are single digit entries. In this example, enter the following: |
| 74 | + |
| 75 | + | Setting | Details | |
| 76 | + | --- | --- | |
| 77 | + | **Name** | Enter `5`.| |
| 78 | + | **Type** | Select `PTR - Pointer record type`. | |
| 79 | + | **TTL and TTL unit** | Use default values. | |
| 80 | + | **Domain name** | Enter `myvm.contoso.com`. | |
| 81 | + |
| 82 | + See the following example: |
| 83 | + |
| 84 | + <img src="./media/private-reverse-dns/create-private-record.png" alt="Screenshot of creating a private reverse DNS record." width="50%"> |
| 85 | + |
| 86 | +3. Select **OK** to create the reverse DNS record. |
| 87 | + |
| 88 | +  |
| 89 | + |
| 90 | +## Add a virtual network link |
| 91 | + |
| 92 | +In order for resources to resolve the reverse DNS zone, you must add a virtual network link pointing to the VNet that contains those resources. You can add multiple virtual network links. In this example, a link is added to the VNet: **myeastvnet** that contains a virtual machine. The virtual machine is then used to verify reverse DNS resolution. |
| 93 | + |
| 94 | +1. Open the private zone overview, and then select **Virtual network links** under **Settings**. |
| 95 | +2. Select **+ Add**. |
| 96 | +3. Enter the following values on the **Add virtual network link** page: |
| 97 | + |
| 98 | + | Setting | Details | |
| 99 | + | --- | --- | |
| 100 | + | **Link name** | Enter a name for your link. For example: **myvlink**.| |
| 101 | + | **Subscription** | Select your subscription. | |
| 102 | + | **Virtual network** | Choose the virtual network that you wish to link to this private DNS zone. | |
| 103 | + | **Configuration** | Don't select the checkbox to enable auto registration. Selecting this setting prevents creation of the virtual network link. | |
| 104 | + |
| 105 | + See the following example: |
| 106 | + |
| 107 | +  |
| 108 | + |
| 109 | +4. Select **OK** and verify that the link is displayed on the Virtual network links page. |
| 110 | + |
| 111 | +## Test DNS resolution |
| 112 | + |
| 113 | +Using a VM in the linked virtual network: open a command line, type **nslookup 10.1.2.5** and press ENTER. |
| 114 | + |
| 115 | +If reverse DNS resolution is working, you see the *ptrdname* (FQDN value) that you entered into the reverse DNS zone: |
| 116 | + |
| 117 | +```PowerShell |
| 118 | +C:\>nslookup 10.1.2.5 |
| 119 | +Server: UnKnown |
| 120 | +Address: 168.63.129.16 |
| 121 | +
|
| 122 | +Name: myvm.contoso.com |
| 123 | +Address: 10.1.2.5 |
| 124 | +``` |
| 125 | + |
| 126 | +## Next steps |
| 127 | + |
| 128 | +* For more information on reverse DNS, see [reverse DNS lookup on Wikipedia](https://en.wikipedia.org/wiki/Reverse_DNS_lookup). |
| 129 | +* Learn how to [manage reverse DNS records for your Azure services](dns-reverse-dns-for-azure-services.md). |
0 commit comments