I’m using Ubuntu 20.04 and BIND 9.16.1. In named.conf.local i’m using three zones
zone "lan" in {
type slave;
file "/var/cache/bind/db.lan";
masters { 192.168.0.7 };
};
zone "local2" in {
type slave;
file "/var/cache/bind/db.local2";
masters { 192.168.0.7 };
masterfile-format text;
};
zone "p2p" in {
type slave;
file "/var/cache/bind/db.p2p";
masters { 192.168.0.7 };
masterfile-format text;
};
But when I would like to change location for file save or masters IP, I need to do it separately per zone. Of course I know that I can use vim and substitution, but still. Is there any way to do it using variable or function or something like that? For example Like:
masterDNS="192.168.0.7"
zone "p2p" in {
type slave;
file "/var/cache/bind/db.p2p";
masters { masterDNS; };
masterfile-format text;
};
Thanks
>Solution :
You can use something like this:
masters masters-ips { 192.168.0.7; };
zone "p2p" in {
type slave;
file "/var/cache/bind/db.p2p";
masters { masters-ips; };
masterfile-format text;
};