2

The $GENERATE directive of bind9 makes it possible to autogenerate the reverse mapping for a range of IPs what is really helpfull for reverse dns of a dhcp range. But it seems that the $GENERATE directive can only generate the reverse dns for a /24 subnet. So is there an easy way to autogenerate the reverse mapping for example the range of a /18 subnet whitout a zone file with more than 16k lines?

A solution with another DNS server or a way without $GENERATE is also welcome.

Hint: The whole reverse zone is a /16 not a /18 but I only need to generate the rDNS PTR RR for the range of a /18.

nazco
  • 387
  • 2
  • 5
  • 11

1 Answers1

4

I don't believe it's possible to nest $GENERATE, if that is what you were going for. $GENERATE in itself creates a sequence for a single range of numbers, not necessarily a /24 in the case of use for reverse zones but not multiple ranges at once (although there are modifiers available that can be used to modify the output to some extent).

However, you couldn't have a /18 network as a single reverse zone anyway, it would be 64 /24 zones.

This is simply based on how IPv4 addresses are mapped to names (eg, 192.0.2.1 -> 1.2.0.192.in-addr.arpa). Based on this mapping, delegation can only happen at the octet boundaries, meaning that zones can only be created for /32, /24, /16 and /8.

(There is the CNAME based solution for sub /24 zones described in rfc2317 but it's really a last resort to deal with small networks that otherwise would be difficult to deal with at all.)

Seeing as you have added information that it is in fact a /16 reverse zone where you want to add records for just a part of your network you could add 64 $GENERATE directives.

An example for something like 10.0.0.0/18:

$GENERATE 0-255 $.0 PTR $.foo.
$GENERATE 0-255 $.1 PTR $.bar.
...
$GENERATE 0-255 $.63 PTR $.baz.
Håkan Lindqvist
  • 35,011
  • 5
  • 69
  • 94
  • Well I meant that I want to generate the rDNS for the **range** of a /18 not that I have a reverse zone with the size of a /18. The whole reverse zone is a /16. – nazco May 24 '14 at 11:20
  • @nazco Ok, good to have that clarified. An option could be to stick 64 $GENERATE directives in there. – Håkan Lindqvist May 24 '14 at 11:24
  • Ok, I've already expected that this would be the only way but I hope to find a solution with only one directive. – nazco May 24 '14 at 11:31