Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to have for each private IP a mapping like this:

ip-192-168-0-1.domain IN A

I am using bind9. Is there any way to use a regex to do this? I know that bind supports wildcard records but I was unable to find any example with regular expressions.

Do I have to add a record for each IP?

share|improve this question
up vote 6 down vote accepted

You can use the $GENERATE statement to define multiple records which only differ by an iterator. For example:

$GENERATE 1-255 ip-192-168-0-$.domain A 192.168.0.$

Edit: It doesn't seem possible to nest $GENERATE statements, so if you need to build records for more than a /24 you'll need a separate line for each /24. You can of course use a script to generate this:

for I in `seq 0 255`; do
    echo "\$GENERATE 1-255 ip-192-168-$I-\$.domain A 192.168.$I.\$"
done >> myzone
share|improve this answer
How can I use this to map – Robert Dolca Feb 15 '13 at 6:38
I'm sure from this information you can find this in the manual and construct the appropriate line your your situation. – mdpc Feb 15 '13 at 7:25
I read the manual before commenting but I found this 'can be used to easily generate the sets of records required to support sub /24 reverse delegations' – Robert Dolca Feb 15 '13 at 7:43
@RobertDolca Edited. – mgorven Feb 15 '13 at 17:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.