Configuring Reverse DNS for BIND

Reverse DNS uses pointer records (PTR) to convert IP addresses into domain names. This is the opposite of forward DNS, which uses A records to convert domain names into IP addresses.

PICK Remember: Generally, rDNS cannot be configured by a website owner. You may need to speak with your system administrator so that he or she can configure and maintain your rDNS configuration.

For the purposes of this article, let's establish a few examples:

Domain IP Address
example.com 192.168.0.1
store.example.com 192.168.0.2
secure.example.com 192.168.0.3
Nameserver  
ns1.example.com  
ns2.example.com  

Creating the Reverse DNS Zone File

To create a reverse DNS zone file, you'll need to locate where zones are stored on your system. This differs depending on whether you are using FreeBSD or Linux to run your server. Zone files can be found at:

  • /var/named/ — Linux distributions
  • /var/named/etc/namedb/ — FreeBSD distributions

Once inside the appropriate directory, you'll need to create a new zone file to store rDNS information. The zone file's name will need to follow a strict format; create it in the following manner:

  • 0.168.192.in-addr.arpanote Note: The IP is written backwards. Because the IP address is 192.168.0.1, the file name should begin with 0.168.192, dropping the last octet in the IP address. This is because the last octet will be specified within the zone file.

Inside the 0.168.192.in-addr.arpa file, you'll need to specify the reverse DNS information using pointer records (PTR). The content of the file should resemble the following:

#######
 
@       IN      SOA     ns1.example.com. host.example.com.     (
                  2009080505 ;Serial Number
                  86400 ;refresh
                  7200 ;retry
                  3600000 ;expire
                  86400 ;minimum

)
 
0.168.192.in-addr.arpa.                IN      NS      ns1.example.com.
0.168.192.in-addr.arpa.                IN      NS      ns2.example.com.
 
1              IN      PTR     example.com.
2              IN      PTR     store.example.com.
3              IN      PTR     secure.example.com.

 
########

PICK Remember: All of the information in the example above will need to be replaced with the information that corresponds to the domains and IP addresses for which you are configuring rDNS. Click the link below to view a key.

Show Key Hide Key

example.com store.example.com
secure.example.com
ns1.example.com ns2.example.com host.example.com
Primary domain Dedicated Subdomains Primary Nameserver Domain Secondary Nameserver Domain Server's Hostname

As you can see from the example, pointer records (PTR) are being used to convert IP addresses into domain names. Meanwhile, 1, 2, and 3 are being used to specify the final octet of the IP address that corresponds to the appropriate domain and subdomains.

Once you are done configuring the rDNS zone file, remember to increment the serial number to save your changes. Failing to increment your serial number will result in your changes being ignored.

Adding the rDNS Zone to named.conf

Once you have finished creating the reverse DNS zone file, you'll need to make sure named.conf knows that it should be included in your BIND configuration. To do this, you'll need to know the location of named.conf.

  • /etc/named.conf — Linux distributions
  • /var/named/etc/namedb/named.conf — FreeBSD distributions

Once you have opened the named.conf file, you'll need to add the following:

Primary DNS Server

zone "0.168.192.in-addr.arpa" IN {
type master;
file "0.168.192.in-addr.arpa";
allow-update { none; };
};

Secondary DNS Server

zone "0.168.192.in-addr.arpa" IN {
type slave;
file "0.168.192.in-addr.arpa";
allow-update { none; };
};

Restarting BIND

Once you have finished creating your rDNS zone file and adding it to named.conf, you'll need to restart BIND. To do so, run the following script:

  • /scripts/restartsrv_named

Once BIND has restarted, your rDNS settings will be a part of your BIND configuration, allowing your domain's IP address to be resolved into its corresponding domain name.

Ensuring Your rDNS Configuration is Working

You can make sure you rDNS configuration is working by issuing a simple command:

  • host 192.168.0.1

In the example above, 192.168.0.1 is meant to represent the IP address that corresponds to the domain, subdomain, or addon domain name for which you have configured rDNS.

If rDNS is properly configured, you will see a message similar to the following:

1.0.192.168.in-addr.arpa domain name pointer example.com

If rDNS is not properly configured, you will see the following message:

Host 1.0.192.168.in-addr.arpa. not found: 3(NXDOMAIN)
Topic revision: r5 - 10 Sep 2009 - 21:14:09 - Main.JustinSchaefer
AllDocumentation/WHMDocs.RdnsForBind moved from Sandbox.RdnsForBind on 10 Sep 2009 - 20:57 by Main.JustinSchaefer - put it back
 

Copyright © cPanel 2000-2009.