Add PTR Record in Windows DNS Server

DNS works by mapping name-to-IP address. To perform this function, we need to know the hostname so that we can get the IP address information from the DNS server. However, sometimes what we have is the IP address and we want to know what hostname that is using this IP address. The good news is that DNS server can also do reverse lookup where mapping is performed from IP address-to-name. To do reverse lookup, DNS server needs a Pointer record (PTR). In this post, we’ll explain the way for administrator to Add PTR Record in Windows DNS Server.

How to Add PTR Record in Windows DNS Server

PTR record can be created automatically when creating Host A record or created manually. There are two ways to manually add PTR record in Windows DNS server. We can either add the PTR Record using DNS Manager or using PowerShell. But before we can add the PTR record, we need to ensure that the related zone has been created in Reverse Lookup Zones. Usually, the zone name for reverse lookup is in x.x.x.in-addr.arpa format, where x.x.x is the first three octets of the IP address in reversed order. For example, zone name for subnet 172.31.1.0/24 is 1.31.172.in-addr.arpa.

Now we’ll use scenario below to demonstrate the steps to add PTR record in Windows DNS server:

AS-DCO001 is a Windows Server 2012 R2 machine, serves as the Domain Controller and DNS server of a domain named mustbegeek.com. An application in the network requires the DNS server to map the IP address information into host name. One of the host named “AS-SVC001” is known to have the IP address of 192.168.0.20. You are the network administrator of mustbegeek.com and you need to add this information in a reversed way so when the application queries the DNS server about the hostname with IP 192.168.0.20, the DNS able to answer the query with hostname “AS-SVC001.mustbegeek.com”.

Add PTR Record using DNS Manager

Open up DNS Manager and browse to the zone name under Reverse Lookup Zones. Ensure the zone name suits the IP subnet of the record that you want to add. In this scenario, the IP subnet is 192.168.0.0/24 therefore the suitable zone name is 0.168.192.in-addr-arpa.

Add PTR Record in Windows DNS Server - 1

Right click on the zone name and select New Pointer (PTR)…

Add PTR Record in Windows DNS Server - 2

The popup window as shown below will appear.

Add PTR Record in Windows DNS Server - 3

In this popup window, fill in the details of the record:

  • Host IP address: in this field, fill in only the last octet of the IP address record that you want to add. For this scenario, the IP address of the server is 192.168.0.20 and therefore fill the host IP address only with “20”. Notice that Fully Qualified Domain Name (FQDN) will be automatically updated as you fill in the IP address field.
  • Host name: type in the FQDN of the hostname that is using the related IP address, or click Browse button to select a valid Host A record for the related hostname. In this example scenario, the FQDN of the hostname is AS-SVC001.mustbegeek.com
  • Optionally, you can tick the option to Delete this record when it becomes stale to make this PTR record becomes dynamic. By default if you don’t tick this option the PTR record will be created as static.
  • Also optionally, tick the option to Allow any authenticated user to update all DNS records with the same name to allow automatic update of this PTR record should the information on the related host is changed.
  • The last detail is also optional, you can choose to modify the TTL value or let it be the default. TTL value configures how long client can keep this record in their resolver cache. In this example we’re setting it to 8 hours.

Add PTR Record in Windows DNS Server - 4

Click OK to finish adding the PTR record.

Add PTR Record using PowerShell

The command to add PTR record using PowerShell is:

Add-DnsServerResourceRecordPtr -Name "IP_ADDRESS_LAST_OCTET" -ZoneName "ZONE_NAME" -PtrDomainName "HOST_NAME_FQDN" [-AllowUpdateAny] [-AgeRecord] [-TimeToLive TTL_VALUE]

Note that you need to run PowerShell as admin to use the command, and you need to modify these variables below according to the details you want.

Mandatory input

  • IP_ADDRESS_LAST_OCTET = Replace this with the last octet of your host IP address. For this example we will replace this value with “20”.
  • ZONE_NAME = Replace this with the zone name that match your host IP subnet. For this example we will replace zone name with “0.168.192.in-addr.arpa”.
  • HOST_NAME_FQDN = Replace this with the FQDN of the hostname. In this scenario the hostname is “as-svc001.mustbegeek.com”.

Optional input

  • [-AllowUpdateAny] = This keyword has the same purpose as the “Allow any authenticated user to update all DNS records with the same name” option. Include this keyword only if you want to allow automatic updates of the PTR record.
  • [-AgeRecord] = Include this keyword only if you want to make the PTR record as dynamic, as this keyword serves the same purpose as option to “Delete this record when it becomes stale”.
  • [-TimeToLive TTL_VALUE] = Only include this keyword if you want to customize the TTL value, and replace the TTL_VALUE with the value in HH:MM:SS format. In this example we replace the value with “08:00:00”.

Below is the full command that reflects the same setting as the previous setting in the DNS Manager:

Add PTR Record in Windows DNS Server - 5

Working with PTR Record in Windows DNS Server

Same with Host A records, multiple PTR Record with the same “Name” can exists together for redundancy or load-balance purpose. However, this may not be the best practice as the DNS server will randomly use one of these records to answer a DNS query.

Add PTR Record in Windows DNS Server - 6

Also, when you add PTR record for an IP address, you need to ensure that the PTR record is pointing to the correct host that is using the same IP address. If a PTR record created pointing to a host that is using different IP address, the result may be invalid.

And that’s all you need to know before you add PTR record in Windows DNS Server.

The following two tabs change content below.
Arranda Saputra

Arranda Saputra

ITIL Certified, CCNA, CCDA, VCP6-DCV, MCSA Administering Windows Server 2012
I am IT practitioner in real life with specialization in network and server infrastructure. I have years of experience in design, analysis, operation, and optimization of infrastructure solutions for enterprise-scaled network. You can send me a message on LinkedIn or email to arranda.saputra@outlook.com for further inquiry regarding stuffs that I wrote or opportunity to collaborate in a project.
scroll to top