$GENERATE Directive

The $GENERATE directive is a BIND specific directive and should not be used if zone files will be ported between BIND and other RFC compliant DNS software.

$GENERATE is provided to ease generation of repetitive sequences of RRs. Only NS, PTR and CNAME RRs are supported. The only known use for $GENERATE is when creating zone files used in delegation of reverse subnet maps. The reverse-map zone files involve a series of RRs which increment by a single value. The following fragment shows an extract from the reverse delegation zone file described in Chapter 3:

$ORIGIN 199.168.192.IN-ADDR.ARPA.
65            IN  CNAME   65.64/26
66            IN  CNAME   66.64/26
67            IN  CNAME   67.64/26 
125           IN  CNAME   125.64/26 
126           IN  CNAME   126.64/26

The following $GENERATE directive would create the full sequence above.

$GENERATE 65-126 $ CNAME $.64/26


$GENERATE start-stop[step] rhs type lhs

Where start is the starting value of the generated sequence and stop is the ending value, step is optional and indicates the value to be added on each iteration, if omitted 1 is assumed, lhs indicates the value of the left hand name. $ indicates the current iteration value will be substituted. The type field is the RR type, only CNAME, NS and PTR are supported, rhs is the left hand expression again $ indicates the current iteration value will be substituted.The rhs and lhs values will have normal $ORIGIN substitution rules applied. The corresponding PTR records used in reverse map delegation will typically have unique host names that cannot be used with the $GENERATE directives i.e. bill, fred, www etc. which do not have a iterator relationship but if the host names were sequentially numbered such as PC65 to PC126 in the above example the $GENERATE directive could be applied to them. Occasionally one wishes life was that simple!

Pro DNS and BIND by Ron Aitchison


tech info
guides home
dns articles
1 objectives
big picture
2 concepts
3 reverse map
4 dns types
5 install bind
6 samples
7 named.conf
8 dns records
9 howtos
10 tools
11 trouble
12 bind api's
13 dns security
bits & bytes
15 messages
notes & tips
registration FAQ
dns resources
dns rfc's
change log