Setting up a classless DNS with Bind9 on Ubuntu and Red Hat Linux flavors


Setting up a classless DNS is critical if you are setting up a mail server on your classless set of IPs. For instance, when my mail users send e-mails to Comcast, Cox, or Time-Warner, my mail is rejected with the following message between the stars:

********************

Subject: Undelivered Mail Returned to Sender

This is the mail system at host melon.skky.net.

I’m sorry to have to inform you that your message could not be delivered to one or more recipients. It’s attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can delete your own text from the attached returned message.

                   The mail system

<mailto:ddietrich@@socal.rr.com>: host hrndva-smtpin02.mail.rr.com[71.74.56.244] refused to talk to me: 421 4.7.1 – Connection refused.  Cannot resolve PTR record for 216.23.169.107

********************

In order to resolve this issue, you must ask your hosting provider to forward reverse DNS queries to your DNS server. Then, you can set up the reverse DNS for your classless range of IPs. Start by editing your named.conf file (/etc/bind/named.conf on Ubuntu, /var/named/chroot/etc/named.conf on Red Hat flavors). Add the following lines–>

zone “96/28.169.23.216.in-addr.arpa” {
 type master;
 file “/etc/bind/96-28.169.23.216.rev”;
};

In my case, my provider assigned me the range of 216.23.169.23.96-216.23.169.110. This is a /28 set of addresses. Notice how we reverse the zone entry. The Class D first, followed by a /, followed by the .Class C.Class B.Class A.in-addr.arpa. The filename roughly matches this as well. I called the file 96-28.169.23.216.rev. Just put this file in your /etc/bind directory on Ubuntu, or /var/named/chroot/var/named on Red Hat Linux flavors (RH5, CentOS, Fedora Core, etc.)

Now for the actual file 96-28.169.23.216.rev contents between the stars –>

****************************

$ttl 38400
$ORIGIN 96/28.169.23.216.in-addr.arpa.
@       1D      IN      SOA     ns1.wiretoss.com. ddietrich.localhost. (
                        1172404866
                        10800
                        3600
                        604800
                        38400 )
        NS      ns1.wiretoss.com.
        NS      ns2.wiretoss.com.
100     PTR     ns1.vitaven.com.
101     PTR     101.wiretoss.com.
102     PTR     102.wiretoss.com.
103     PTR     103.wiretoss.com.
104     PTR     104.wiretoss.com.
105     PTR     105.wiretoss.com.
106     PTR     106.wiretoss.com.
107     PTR     ns1.wiretoss.com.
108     PTR     108.wiretoss.com.
109     PTR     109.wiretoss.com.
110     PTR     110.wiretoss.com.
****************************

Restart bind9 and you should now have a happy reverse DNS to the rest of the world, and especially those pesky mail servers that check for everything.

,