Variable in name of file for named.conf

Darcy Kevin (FCA) kevin.darcy at fcagroup.com
Thu Apr 2 18:46:13 UTC 2015


It would be a nice feature, but in lieu of that, you could always have a script manage your named.conf and incorporate the variable-substitution logic into that. If you want to go Old School, use cpp, make, sccs, some of those long-forgotten tools :-)

											- Kevin

-----Original Message-----
From: bind-users-bounces at lists.isc.org [mailto:bind-users-bounces at lists.isc.org] On Behalf Of Barry Margolin
Sent: Wednesday, April 01, 2015 10:09 PM
To: comp-protocols-dns-bind at isc.org
Subject: Re: Variable in name of file for named.conf

In article <mailman.1867.1427927445.26362.bind-users at lists.isc.org>,
 Jeff Sadowski <jeff.sadowski at gmail.com> wrote:

> I have a number of slave domains that I would like a naming scheme and 
> not have to go to each and change the filename.
> 
> I have the following zones
> 
> zone "1.168.192.in-addr.arpa" {
>         include "named.slave";
> };
> zone "2.168.192.in-addr.arpa" {
>         include "named.slave";
> };
> zone "3.168.192.in-addr.arpa" {
>         include "named.slave";
> };
> zone "4.168.192.in-addr.arpa" {
>         include "named.slave";
> };
> zone "5.168.192.in-addr.arpa" {
>         include "named.slave";
> };
> zone "6.168.192.in-addr.arpa" {
>         include "named.slave";
> };
> zone "7.168.192.in-addr.arpa" {
>         include "named.slave";
> };
> zone "8.168.192.in-addr.arpa" {
>         include "named.slave";
> };
> zone "9.168.192.in-addr.arpa" {
>         include "named.slave";
> };
> zone "10.168.192.in-addr.arpa" {
>         include "named.slave";
> };
> 
> named.slave looks as follows
> 
> type slave;
> masters {192.168.1.2;};
> file "data/db. at .slave";
> 
> It appears to work on my queries.
> 
> nslookup 192.168.1.2
> 
> 2.1.168.192.in-addr.arpa      name = pdc.<domain>
> 
> nslookup 192.168.1.1
> 
> 1.1.168.192.in-addr.arpa      name = gw1.<domain>
> 
> nslookup 192.168.2.1
> 
> 1.2.168.192.in-addr.arpa      name = gw2.<domain>
> 
> the only file created in my data directory seems to be db. at .slave with 
> the at sign.

Why would you expect anything different? @ only has special meaning inside zone files, it's not special in named.conf.

> 
> Do I really need to have each zone with its own file?

Yes, you do. What's happening is that every time one of the reverse zones is transferred, it's overwriting that file. But the files are only used when initializing the zones when named starts up; you get the correct answers because the in-memory versions of the zones are distinct. But try restarting named and then see what happens when you do those nslookups. You'll see that 192.168.1.1 and 192.168.2.1 both return the same name.

> 
> Is there a special syntax to get what I expect?
> expected files:
> data/db.1.168.192.in-addr.arpa.slave
> data/db.2.168.192.in-addr.arpa.slave
> data/db.3.168.192.in-addr.arpa.slave
> ...
> data/db.10.168.192.in-addr.arpa.slave
> 
> if not I can have Make do it and build some scripts to do what I want 
> but if there is syntax to do what I want it would be nice.

No, there's no built-in syntax to create the filename based on the zone name.

--
Barry Margolin
Arlington, MA
_______________________________________________
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe from this list

bind-users mailing list
bind-users at lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


More information about the bind-users mailing list