Setting Up Reverse DNS — PTR Record

What is the reverse DNS?

Reverse DNS is an IP address to domain name mapping – the opposite of Forward DNS which maps domain names to IP addresses.

Comparison:

## FORWARD LOOKUP ##

# host centos.org
centos.org has address 72.232.194.162

## REVERSE LOOKUP ##

# host 72.232.194.162
162.194.232.72.in-addr.arpa domain name pointer www.centos.org.

What does the Reverse DNS serve for?

The Reverse DNS is one of the basic requirements for running some Internet protocols. It is also often used as a spam filter to determine whether the IP address of the incoming message matches an authenticated domain name and to block the message if it doesn’t.

Who controls the reverse DNS?

Reverse DNS is controlled by the owner of the IP address (probably your SIP).

How to check the reverse DNS?

Using one of the following commands, you can get the reverse DNS.

Using the ‘host’ command:

# host 72.232.194.162
162.194.232.72.in-addr.arpa domain name pointer www.centos.org.

Using the ‘nslookup’ command:

# nslookup 208.80.152.201
162.194.232.72.in-addr.arpa     name = www.centos.org.

Using the ‘dig’ command:

# dig -x 208.80.152.201
162.194.232.72.in-addr.arpa. 859 IN     PTR     www.centos.org.

Configuring the reverse DNS

Lets setup PTR record for the IP address ‘192.168.0.5’. It should be pointed to ‘your.site.name’.

Add the new zone to the ‘named.conf’ file as follows:

zone "0.168.192.in-addr.arpa" {
type master;
file "/var/named/0.168.192.in-addr.arpa";
};

Create the zone file ‘/var/named/0.168.192.in-addr.arpa’, and add the the following content:

$TTL 3600
@          IN SOA ns0.name.server. root.ns0.name.server. (
              2012020801       ; Serial
              21600             ; refresh
              3600              ; retry
              3600000           ; expire
              86400 )           ; minimum

           IN  NS ns0.name.server.
           IN  NS ns1.name.server.

; ----------- ENREGISTREMENTS -----------
$ORIGIN 0.168.192.in-addr.arpa.
5                      IN PTR                  your.site.name.
; ----------- ENREGISTREMENTS SPECIAUX -----------

Where ‘ns0.name.server’ and ‘ns1.name.server’ are your DNS servers.

Save the changes and reconfig ‘named’:

# rndc reconfig

Check the PTR:

# dig -x  192.168.0.5 @ns0.name.server +short
your.site.name.
Was it useful? Share this post with the world!

3 Replies to “Setting Up Reverse DNS — PTR Record”

  1. $TTL 1D
    $ORIGIN 11.168.192.in-addr.arpa
    @ IN SOA server1.itaugur.online. root.server1.itaugur.online. (
    0 ; serial
    1D ; refresh
    1H ; retry
    1W ; expire
    3H ) ; minimum

    NS server1.itaugur.online.
    131 PTR server1.itaugur.online.

    ****************************** I have tried this configuration…. But, I can’t understood that where I am wrong.

  2. В файле named.conf:
    file “/var/named/0.168.192.in-addr.arpa”

    не хватает ‘;’

    1. Спасибо.

Leave a Reply