Adding Similar Records

2.19.1 Problem

You want to add a number of records that differ only slightly.

2.19.2 Solution

Use the $GENERATE control statement to specify a template that the name server will use to generate a group of similar records. For example, to add a series of PTR records that differ only by a single digit, you could use this $GENERATE control statement:

$GENERATE 11-20 $.0.168.192.in-addr.arpa. PTR dhcp-$.foo.example.

Your BIND name server will read the range (11-20) and it will also read the template ($.0.168.192.in-addr.arpa. PTR dhcp-$.foo.example.) from the $GENERATE control statement. Then it will iterate through the range, replacing any dollar signs ("$") in the template with the current value, creating 10 PTR records:

11.0.168.192.in-addr.arpa. PTR dhcp-11.foo.example.
12.0.168.192.in-addr.arpa. PTR dhcp-12.foo.example.
13.0.168.192.in-addr.arpa. PTR dhcp-13.foo.example.
...
20.0.168.192.in-addr.arpa. PTR dhcp-20.foo.example.

2.19.3 Discussion

$GENERATE supports a limited set of record types: A, AAAA, CNAME, DNAME, NS and PTR. Also, the template can't contain a TTL or a class field, just a type.

If you want to get fancy, you can also step through the range using the range format start-stop/range. So 0-100/2 would count from 0 to 100 by twos.

BIND 8.2 introduced $GENERATE to the world. BIND 9.1.0 introduced $GENERATE to the BIND 9 releases.

Note that, unlike the $INCLUDE and $ORIGIN control statements, $GENERATE is only supported by BIND name servers; you can't use it in a zone data file on a Microsoft DNS Server, for example.

2.19.4 See Also

"Subnetting on a Non-Octet Boundary" in Chapter 9 of DNS and BIND, and Section 6.3.6 of the BIND 9 Administrator Reference Manual.

Getting Started

Zone Data

BIND Name Server Configuration

Electronic Mail

BIND Name Server Operations

Delegation and Registration

Security

Interoperability and Upgrading

Resolvers and Programming

Logging and Troubleshooting

IPv6



DNS & BIND Cookbook
DNS & BIND Cookbook
ISBN: 0596004109
EAN: 2147483647
Year: 2005
Pages: 220
Authors: Cricket Liu

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net