I'm running an authoritative nameserver for a reverse /16 zone, where every IP is mapped to a custom subdomain.
This is achieved by a zone file with 256 $GENERATE
directives, for example (subnet 11.22.0.0/16):
$GENERATE 0-255 $.1 PTR $.1.22.11.rev.example.com.
$GENERATE 0-255 $.2 PTR $.2.22.11.rev.example.com.
(...)
This works fine, the only issue is that whenever we add a "meaningful" reverse record (4.3.22.11.in-addr.arpa. IN PTR www.example.com.
) it will result in a situation where there are 2 PTR records for the same IP address:
4.3.22.11.in-addr.arpa. IN PTR www.example.com.
4.3.22.11.in-addr.arpa. IN PTR 4.3.22.11.rev.example.com.
For the most part this is fine, but in some cases we need to have a single PTR record.
The solution has been to "unroll" the $GENERATE
block into individual PTR records and replace the offending one. Is there a way to override a generated record without having to expand the whole range?
This nameserver runs BIND 9.8.2 on RHEL6.
Best Answer
The
$GENERATE
Directive only has two forms for range: start-stop or start-stop/step. Because of this you can't exclude one IP from the range, but you have to split the range accordingly, e.g.