Table of Contents

BIND (bind.py)

Bind Internal and External Configuration Example : Master / Slave



Introduction


Master Server : named.conf

acl "internal-network" {
        10.50.0.0/24;
        10.50.1.0/24;
};

options {
        version         "unknown";
        directory "/var/named";

        allow-query     { localhost; internal-network; };

        allow-transfer {
            XXX.XXX.XX.XX;     // Slave DNS
        };
        
        forwarders {
            XXX.XXX.XX.XX;     // ISP
        };
        forward only;          // don't use root name server
};

logging
{
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};


view "internal"
{
        match-clients { localhost; internal-network; };
        match-destinations { localhost; internal-network; };

        zone "localhost" {
            type master;
            file "named.local";
        };

        zone "0.0.127.in-addr.arpa" {
            type master;
            file "named.localrev";
        };


        //example.local
        zone "example.local" {
            type master;
            file "named.example";
            allow-query { any; };
            allow-update { none; };
            allow-transfer { xx.xx.xx.xx; };        // Slave DNS
        };

        //192.168.0.0/24
        zone "0.168.192.in-addr.arpa" {
            type master;
            file "0.168.192.in-addr.arpa";
            allow-query { any; };
            allow-update { none; };
            allow-transfer { xx.xx.xx.xx; };        // Slave DNS
        };

}

view "external"
{
        match-clients { any; };
        match-destinations { any; };
        recursion no;

        //example.com
        zone "example.com" {
            type master;
            file "named.example";
            allow-query { any; };
            allow-update { none; };
            allow-transfer { xx.xx.xx.xx; };        // Slave DNS
        };

}

// Master DNS Server
zone "xxxxxxxxxxxx" {
    type master;            // Master DNS Server
    file "xxxxxxxx";
    slaves { xxx.xxx.xxx.xxx };       //Slave
};


Slave Server : named.conf

// Slave DNS Server
zone "xxxxxxxxxxxx" {
    type slave;            // Slave DNS Server
    file "xxxxxxxx";
    masters { xxx.xxx.xxx.xxx };       //Master
};

acl "internal-network" {
        10.50.0.0/24;
        10.50.1.0/24;
};

options {
        version         "unknown";
        directory "/var/named";

        allow-query     { localhost; internal-network; };

        allow-transfer {
            XXX.XXX.XX.XX;     // Slave DNS
        };
        
        forwarders {
            XXX.XXX.XX.XX;     // ISP
        };
        forward only;          // don't use root name server
};

logging
{
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};


view "internal"
{
        match-clients { localhost; internal-network; };
        match-destinations { localhost; internal-network; };

        zone "localhost" {
            type master;
            file "named.local";
        };

        zone "0.0.127.in-addr.arpa" {
            type master;
            file "named.localrev";
        };


        //example.local
        zone "example.local" {
            type slave;
            file "named.example";
            allow-query { any; };
            allow-update { none; };
            masters { xx.xx.xx.xx; };        // Master DNS Server
        };

        //192.168.0.0/24
        zone "0.168.192.in-addr.arpa" {
            type slave;
            file "0.168.192.in-addr.arpa";
            allow-query { any; };
            allow-update { none; };
            masters { xx.xx.xx.xx; };        // Master DNS Server
        };

}

view "external"
{
        match-clients { any; };
        match-destinations { any; };
        recursion no;

        //example.com
        zone "example.com" {
            type slave;
            file "named.example";
            allow-query { any; };
            allow-update { none; };
            masters { xx.xx.xx.xx; };        // Master DNS Server
        };

}


/var/named/named.localhost

$TTL 1D
@       IN SOA  @ rname.invalid. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      @
        A       127.0.0.1
        AAAA    ::1


/var/named/named.loopback

$TTL 1D
@       IN SOA  @ rname.invalid. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      @
        A       127.0.0.1
        AAAA    ::1
        PTR     localhost.


BIND (bind.py)





BIND (bind.py)