4

I have this zone file in bind:

        $TTL 86400
        mysite.net. IN SOA ns1.mysite.net. admin.mysite.net. (
        2006012008
        86400
        3600
        604800
        86400
        )
        mysite.net.      IN      NS      ns1.mysite.net.
        mysite.net.      IN      NS      ns2.mysite.net.
        mysite.net.      IN      A       1.2.3.4
        www.mysite.net.  IN      A       1.2.3.4
        mail.mysite.net.  IN      A      1.2.3.4
        newsite.mysite.net.  IN      A      1.2.3.4
        shop.mysite.net.  IN      A       101.102.103.104
        mysite.net.      IN      MX      30 mail.mysite.net.
        ns1                   IN      A      1.2.3.4
        ns2                   IN      A      1.2.3.4

I need a reverse zone file. How do I create this, and how do I put it in named.conf?

I have a dedicated server with one assigned IP address.

EDIT

IP and hostname are only for example

lillolollo
  • 53
  • 1
  • 1
  • 4

2 Answers2

5

Reverse DNS lookups for IPv4 use a reversed IP address (to work within the hierarchical structure of DNS) in the zone in-addr.arpa.

So to provide answers to queries against, for instance, 192.0.2.0, a DNS server should answer for 0.2.0.192.in-addr.arpa.

However, it's unlikely that your hosting company has delegated to your server for that address, since the smallest normal DNS parent domain that your address is in is a /24.

You may be able to contact your host and get them to delegate the /32 address to your DNS server via the method in RFC 2317, but it's simpler and more likely to be supported by your host to just have them set the record to what you want it to be.

Shane Madden
  • 112,982
  • 12
  • 174
  • 248
2

Using the addresses you have in the zone file above, 1.2.3.4 and 101.102.103.104 there are two PTR records you will be concerned with - 4.3.2.1.in-addr.arpa and 104.103.102.101.in-addr.arpa.

IF you are delegated management of the reverse zones 3.2.1.in-addr.arpa and 103.102.101.in-addr.arpa zones you can declare them in your named.conf file, e.g.:

zone "3.2.1.in-addr.arpa" in {
  type master;
  file "3.2.1.rev";
};

and create zone files and populate them with PTR records, e.g.:

$TTL 2d  ; 172800 seconds
$ORIGIN 3.2.1.IN-ADDR.ARPA.
@             IN      SOA   ns1.example.com. hostmaster.example.com. (
                              2013010304 ; serial number
                              3h         ; refresh
                              15m        ; update retry
                              3w         ; expiry
                              3h         ; nx = nxdomain ttl
                              )
              IN      NS      ns1.example.com.
              IN      NS      ns2.example.com.
4             IN      PTR     mysite.net.
; etc

The problem is that as the other replies have said, unless you are delegated authority for the reverse zones by whoever has been assigned your address block by ARIN (or whichever regional internet registry controls assignments for your region) you can have your name server publish any zones you want but nobody will ever find them by following a delegation chain from the root.

Thus it's important that you understand who should be publishing the records, whether it's your responsibility or someone else's.

Michael McNally
  • 1,450
  • 9
  • 14
  • Yes I know, infact I change my /etc/resolve.conf to nameserver 127.0.0.1 yesterday all seemd ok. site ok reverse dns ok. But today my site is unreachable to fix it I added the old dns server site ok but reverse dns no – lillolollo Jan 05 '13 at 05:05
  • can I use `4 IN PTR mysite.net.` and ` 4 IN PTR mail.mysite.net.`? – lillolollo Jan 05 '13 at 07:22
  • PTRs are not a singleton type so you *can* have an rrset of them with more than one value, but it is not generally a great idea because there are programs out there that expect PTRs to be singletons and don't handle them well if they are not. – Michael McNally Jan 07 '13 at 06:40
  • So how I can set up rzone? – lillolollo Jan 07 '13 at 23:41
  • I'm not sure I understand what you're asking. You create a zone master file and edit it appropriately. You declare the zone in your named.conf. You use rndc to tell the server to pick up the new zone, or you stop and restart your server. There's not much more to it than that. – Michael McNally Jan 08 '13 at 02:39