Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 3 down vote accepted

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, -> 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

$GENERATE 0-255 $.0 PTR $.foo.
$GENERATE 0-255 $.1 PTR $.bar.
$GENERATE 0-255 $.63 PTR $.baz.
share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.