How to setup wildcard DNS entries with BIND

If you need to setup many similar DNS entries for a zone, then you can use bind's GENERATE directive to create wildcard entries:

In a forward DNS zone:

$ORIGIN dynamic.yourdomain.net.
$GENERATE 1-254 adsl-1-2-3-$ A 1.2.3.$

Which is equivalent to 254 lines of:

adsl-1-2-3-1.dynamic.yourdomain.net.   A 1.2.3.1
...
adsl-1-2-3-254.dynamic.yourdomain.net. A 1.2.3.254

In a reverse DNS zone:

$ORIGIN 2.1.in-addr.arpa.
$GENERATE 1-254 $.3 PTR adsl-1-2-3-$.dynamic.yourdomain.net.

Which is equivalent to 254 lines of:

1.3.2.1.in-addr.arpa.   PTR adsl-1-2-3-1.dynamic.yourdomain.net.
...
254.3.2.1.in-addr.arpa. PTR adsl-1-2-3-254.dynamic.yourdomain.net.

Last updated: 12/06/2008