Reverse DNS - IP Address to Name (db.yourIPreversed)
From Debian Clusters
This is the fourth page of a five part tutorial on setting up Name Service: DNS and BIND. The full tutorial includes
- Name Service: DNS and BIND
- Installing and Configuring BIND
- Creating Forward DNS Records
- Creating Reverse DNS Records
- Testing and Troubleshooting BIND
db.yourIPreversed
/etc/bind/db.yourIPreversed is the file responsible for reverse DNS, finding a host's domain name from its IP address. This is the db.yourIPreversed file we referred to in the /etc/bind/named.conf.local file two sections ago. It needs to be manually created.
The first parts, the TTL, SOA record, and the nameserver should be set up as in Forward DNS - Name to IP Address (db.yourdomain). Look back to that page for a refresher. You should be able to copy it, and then change the places that specify the domain. In mine, references to raptor.loc. needed to be changed to 1.168.192.in-addr.arpa.
$TTL 24h
1.168.192.in-addr.arpa. IN SOA eyrie.raptor.loc. root.raptor.loc (
2007062800 ; serial number
3h ; refresh time
30m ; retry time
7d ; expire time
3h ; negative caching ttl
)
# Nameservers
1.168.192.in-addr.arpa. IN NS 192.168.1.254
PTR Records
Instead of address records, however, the information for getting hostnames from IP addresses needs to be specified. When DNS looks up a host name by IP address, it reverses the order of the octets and appends in-addr.arp as the IP "hostname". This record needs to store those records and point to what their real domain names are. These are called the PTR records. The format for these is
<IP with order reversed>.in-addr.arpa. IN PTR <full domain name>.
My full /etc/bind/db.1.168.192 file is below.
$TTL 24h
1.168.192.in-addr.arpa. IN SOA eyrie.raptor.loc. root.raptor.loc (
2007062800 ; serial number
3h ; refresh time
30m ; retry time
7d ; expire time
3h ; negative caching ttl
)
; Nameservers
1.168.192.in-addr.arpa. IN NS 192.168.1.254.
; Hosts
254.1.168.192.in-addr.arpa. IN PTR eyrie.raptor.loc.
200.1.168.192.in-addr.arpa. IN PTR gyrfalcon.raptor.loc.
201.1.168.192.in-addr.arpa. IN PTR kestrel.raptor.loc.
202.1.168.192.in-addr.arpa. IN PTR owl.raptor.loc.
203.1.168.192.in-addr.arpa. IN PTR goshawk.raptor.loc.
204.1.168.192.in-addr.arpa. IN PTR osprey.raptor.loc.
205.1.168.192.in-addr.arpa. IN PTR peregrine.raptor.loc.
206.1.168.192.in-addr.arpa. IN PTR kite.raptor.loc.
207.1.168.192.in-addr.arpa. IN PTR eagle.raptor.loc.
208.1.168.192.in-addr.arpa. IN PTR harrier.raptor.loc.
Restarting Bind
Bind is now ready to be restarted and tested! Issue
/etc/init.d/bind9 restart
and continue on to Testing and Troubleshooting BIND.

