Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

BIND – named.conf.local and define variables/functions?

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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;
    };

See additional examples

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading