Thursday, June 20, 2024
HomeUNIX softwareBIND and DNSDNS/BIND resource record: using $GENERATE to make many records

DNS/BIND resource record: using $GENERATE to make many records

A cool feature in versions of BIND since 8.2 and 9.1 is the $GENERATE directive which can create hundreds or thousands of resource records with a single line in zone file. A common use for $GENERATE is assigning PTR records for a DHCP address range.

Given the subnet which is reserved (with the exception of reserved addresses for use by a DHCP server pool, reverse lookup (PTR) records of the format (where # is the address) can be created with the following line in the zone file:

$GENERATE 11-254 $ PTR dhcp$

This will generate the following records:

11 PTR
12 PTR
13 PTR
253 PTR
254 PTR

This code works assuming that the zone file is associated with the domain. The $GENERATE is currently only compatible with the A, AAAA, CNAME, DNAME, NS and PTR resource record types.

Quinn McHenry
Quinn McHenry
Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.


Please enter your comment!
Please enter your name here

Most Popular


Recent Comments

error: Content is protected !!