There are many types of DNS records and it can be overwhelming for beginners to understand which DNS record is necessary or how to setup one. In this tutorial you will learn what a PTR record is and how to check if it’s set for an IP address.
What is a PTR Record
In short a PTR record is like a reverse version of A record. A record maps domain name to an IP address, PTR maps an IP address to a hostname. However, these two records are independent. For example, A record of hostinger.com can point to 21.21.128.xx IP address, while 23.23.128.xx can be mapped to a totally different hostname.
Why you need a PTR Record
It’s useful for outgoing mail servers. This record adds reliability for sending server and allows receiving end to check the hostname of an IP address. This is a great way of protection against all sort of spammers who use fraudulent domain names to send spam. That’s why some major email providers like yahoo.com, gmail.com do a reverse DNS lookup before accepting incoming emails.
What you’ll need
Before you begin this guide, you’ll need the following:
- Access to your computer console (optional)
Method 1 – Checking PTR with nslookup or dig
Windows and Unix like systems (Linux, MacOS) have inbuilt tools to check DNS records. If you are a Windows user, follow the steps bellow:
- Access Windows start menu, type in
cmdand press ENTER.
- You should now see a black Command Prompt window.
- Type in the following command to get the hostname of the IP address (remember to change IP_ADDESS to real IP):
- For example, if you would want to check PTR record of 54.243.154.xx, you would see a result similar to this one:
C:\Users\Tom>nslookup 54.243.154.xxx Server: server1.yourisp.com Address: 121.91.3.xx Name: ec2-54-243-154-49.hostinger.com Address: 54.243.154.xx
As you can see, PTR record is ec2-54-243-154-49.hostinger.com.
For Linux and Mac users the process is similar:
- On MacOS, access terminal from launcher (F4). Most of Linux distributions allow to open terminal by pressing Ctrl+Alt+T keys at the same time.
- Use the following command to check the record (remember to change IP_ADDRESS to real IP):
dig -x IP_ADDRESS
- For example, checking PTR record of 54.243.154.xx IP address would print similar results:
dmins-Mac-mini:~ domantas$ dig -x 54.243.154.xx ; <<>> DiG 9.8.3-P1 <<>> -x 54.243.154.xx ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26997 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;xx.154.243.54.in-addr.arpa. IN PTR ;; ANSWER SECTION: xx.154.243.54.in-addr.arpa. 250 IN PTR ec2-54-243-154-49.hostinger.com ;; Query time: 34 msec ;; SERVER: 318.104.22.168#53(22.214.171.124) ;; WHEN: Fri Dec 30 11:38:29 2016 ;; MSG SIZE rcvd: 99
From the ANSWER SECTION you can see that PTR record is ec2-54-243-154-49.hostinger.com
Method 2 – Using Online Tools
Yet, another way to find out the hostname of the IP address is to use online reverse lookup tools like MxToolBox. All you need to do is enter the IP address in the field and press Reverse Lookup button.
Unfortunately, if lookup shows that the record is not set for an IP address, in most cases, you will have to contact your hosting provider or ISP with a request to create one. However, you now know what PTR record is and how to check whether IP address has one. This is useful if you experience DNS errors and bounce backs while trying to send emails as it will help you to troubleshoot the issue.