factor addresses out of 'forwarders' statement

Grant Taylor gtaylor at tnetconsulting.net
Thu Jul 18 22:52:36 UTC 2019


On 7/18/19 3:24 PM, John Thurston wrote:
> I have a number of 'forward' zones defined. Many of them look exactly 
> the same except for their name. It would be helpful to abstract the 
> addresses of my forwarders out and name them only once. But I can't find 
> any way to do this.
> 
> An ACL doesn't make sense. A 'masters' list doesn't work.
> 
> Is there some way to do this?
> 
> alias { 10.10.1.2; 10.10.3.4; 10.10.5.6; }
> zone "foo" {type forward; forwarders ( alias;}; };

Maybe.

Take a look at include statements.

You'll probably need to have the contents of the alias in it's own file:

--8<--
10.10.1.2; 10.10.3.4; 10.10.5.6;
-->8--

Then construct your zone statement a little bit differently.

--8<--
zone "foo" {type forward; forwarders (
include "/path/to/alias/file"
); };
-->8--

You are functionally doing what you want.

What you're really doing is manipulating text files that happen to be 
the aggregate BIND config file.

You could probably move more of the duplicate part of the config into 
the included file and have less to type for each zone.

Note:  I've not tested this in a while, things may have changed since I 
last tried this.

The other non-BIND option is to use some sort of pre-processor to 
generate your BIND config file for you.  I personally reach for M4 for 
things like this.  I can define a macro that accepts the zone name as a 
parameter.  Then I use the macro for each zone and let M4 stamp out the 
necessary config lines for me.  }:-)

Then there are the other zone loading methods, DLZ, catalog zones, etc.



-- 
Grant. . . .
unix || die

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4008 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20190718/ab060a01/attachment.bin>


More information about the bind-users mailing list