In the last post I explained how to configure forward DNS (turning the name into an IP address). In this post I’ll tell you how to configure BIND so that it turns an IP address into a name. I’ll also explain the SOA information at the top of the zone files.
Reverse DNS
We’re using the 192.168.x.x network so I’ll use the file /etc/bind/db.192.168. Change the name of the file as appropriate for your network. Copy the following into your file
;
; BIND reverse data file for local network
;
$TTL 604800
@ IN SOA localhost. root.localhost. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS localhost.
You now need to add entries for each IP address in the form
xxx.yyy IN PTR sbs.example.com.
This turns the IP number 192.168.yyy.xxx into the name sbs.example.com.
Once you have created the zone file you need to add it to /etc/bind/bind.conf.local
zone "168.192.in-addr.arpa" in{
type master;
file "/etc/bind/db.192.168";
allow-update{none;};
};
To hide this from people outside of the network I included it in the “external” view created in the previous post. Restart bind and you should now be able to resolve IP numbers into names.
Start of Authority – SOA
The SOA record is the first thing that appears in the zone file. The format is
<domain.name.> IN SOA <hostname.domain.name.> <mailbox.domain.name>
<serial-number>
<refresh>
<retry>
<expire>
<minimum-ttl>
Serial-number is the serial number for this version of the file. You need to increment this each time you make a change to the zone file. A good idea is to use the current date and a number in the format YYYYMMDDnn where nn is a unique number for that day. So the first zone file for today would have 2007021801.
Refresh is how many seconds to wait before polling the primary name server to see if the serial number has changed.
Retry is how many seconds to wait if a refresh fails before trying again.
Expire is the number of seconds after both a refresh and retry fail before the domain name server stops serving the domain.
Minimum-TTL is the minimum time for an entry to live.
Next time I’ll cover setting up MySQL.
This site contains my personal ramblings on Linux, PHP, Java, .NET and anything else that I feel is important.