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 dhcp#.tech-recipes.com. (where # is the address) can be created with the following line in the zone file:

$GENERATE 11-254 $ PTR dhcp$.tech-recipes.com.

This will generate the following records:

11 PTR dhcp11.tech-recipes.com.
12 PTR dhcp12.tech-recipes.com.
13 PTR dhcp13.tech-recipes.com.
253 PTR dhcp253.tech-recipes.com.
254 PTR dhcp254.tech-recipes.com.

This code works assuming that the zone file is associated with the 2.168.192.in-addr.arpa. 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

- Advertisment -

Most Popular

Recent Comments

Cleveland Furia on How to Clear Google Activity
Sid Wohlfarth on How to Clear Google Activity
Riley Magsayo on How to Clear Google Activity
สมัครรับเครดิตฟรี ทันที on How to improve Remote Desktop Protocol Performance
Neal Wangstad on How to Clear Google Activity
Slavcho Andov on How to install Ubuntu
Slavcho Andov on How to fix bad sectors
Sheraz Ali on How to Backup Android