Bind For Private Network DNS Server: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 15: Line 15:
<source lang="ini">
<source lang="ini">
acl "trusted" {
acl "trusted" {
         19.83.10.1;  # gtw
         10.19.83.1;  # gtw
         19.83.10.2;  # apn
         10.19.83.2;  # apn
         19.83.10.3;  # rpi, dns
         10.19.83.3;  # rpi, dns
         19.83.10.6;  # ceo
         10.19.83.6;  # ceo
         19.83.10.10;  # mac
         10.19.83.10;  # mac
};
};


Line 26: Line 26:
         recursion yes;                # enables resursive queries
         recursion yes;                # enables resursive queries
         allow-recursion { trusted; };  # allows recursive queries from "trusted" clients
         allow-recursion { trusted; };  # allows recursive queries from "trusted" clients
         listen-on { 19.83.10.3; };    # dns private IP address - listen on private network only
         listen-on { 10.19.83.3; };    # dns private IP address - listen on private network only
         allow-transfer { none; };      # disable zone transfers by default
         allow-transfer { none; };      # disable zone transfers by default
         forward first;
         forward first;
Line 46: Line 46:
};
};


zone "19.83.10.in-addr.arpa" {
zone "83.19.10.in-addr.arpa" {
     type master;
     type master;
     file "/etc/bind/zones/db.19.83.10";      # 19.83.10.0/24 subnet
     file "/etc/bind/zones/db.83.19.10";      # 10.19.83.0/24 subnet
};
};
</source>
</source>
Line 74: Line 74:
;
;
; name servers - A records
; name servers - A records
dns.dev.shahed.biz.        IN      A      19.83.10.3
dns.dev.shahed.biz.        IN      A      10.19.83.3


; 19.83.10.0/24 - A records
; 10.19.83.0/24 - A records
gtw.dev.shahed.biz.        IN      A      19.83.10.1
gtw.dev.shahed.biz.        IN      A      10.19.83.1
apn.dev.shahed.biz.        IN      A      19.83.10.2
apn.dev.shahed.biz.        IN      A      10.19.83.2
rpi.dev.shahed.biz.        IN      A      19.83.10.3
rpi.dev.shahed.biz.        IN      A      10.19.83.3
ceo.dev.shahed.biz.        IN      A      19.83.10.6
ceo.dev.shahed.biz.        IN      A      10.19.83.6
mac.dev.shahed.biz.        IN      A      19.83.10.10
mac.dev.shahed.biz.        IN      A      10.19.83.10
</source>
</source>


<source lang="bash">
<source lang="bash">
cp /etc/bind/db.127 /etc/bind/zones/db.19.83.10
cp /etc/bind/db.127 /etc/bind/zones/db.83.19.10
nano /etc/bind/zones/db.19.83.10
nano /etc/bind/zones/db.10.19.83
</source>
</source>


Line 105: Line 105:
;
;
; PTR Records
; PTR Records
1.10    IN      PTR    gtw.dev.shahed.biz.    ; 19.83.10.1
1.10    IN      PTR    gtw.dev.shahed.biz.    ; 10.19.83.1
2.10    IN      PTR    apn.dev.shahed.biz.    ; 19.83.10.2
2.10    IN      PTR    apn.dev.shahed.biz.    ; 10.19.83.2
3.10    IN      PTR    dns.dev.shahed.biz.    ; 19.83.10.3
3.10    IN      PTR    dns.dev.shahed.biz.    ; 10.19.83.3
3.10    IN      PTR    rpi.dev.shahed.biz.    ; 19.83.10.3
3.10    IN      PTR    rpi.dev.shahed.biz.    ; 10.19.83.3
6.10    IN      PTR    ceo.dev.shahed.biz.    ; 19.83.10.6
6.10    IN      PTR    ceo.dev.shahed.biz.    ; 10.19.83.6
10.10  IN      PTR    mac.dev.shahed.biz.    ; 19.83.10.10
10.10  IN      PTR    mac.dev.shahed.biz.    ; 10.19.83.10
</source>
</source>


<code>nano /etc/resolv.conf</code>
<code>nano /etc/resolv.conf</code>
<source lang="ini">
<source lang="ini">
nameserver 19.83.10.3
nameserver 10.19.83.3
nameserver 8.8.8.8
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 8.8.4.4
Line 123: Line 123:
<code>nano /etc/network/interfaces</code>
<code>nano /etc/network/interfaces</code>
<source lang="ini">
<source lang="ini">
dns-nameservers 19.83.10.3 8.8.8.8 8.8.4.4
dns-nameservers 10.19.83.3 8.8.8.8 8.8.4.4
dns-search dev.shahed.biz
dns-search dev.shahed.biz
</source>
</source>
Line 131: Line 131:
named-checkconf -z
named-checkconf -z
named-checkzone dev.shahed.biz /etc/bind/zones/db.dev.shahed.biz
named-checkzone dev.shahed.biz /etc/bind/zones/db.dev.shahed.biz
named-checkzone 19.83.10.in-addr.arpa /etc/bind/zones/db.19.83.10
named-checkzone 83.19.10.in-addr.arpa /etc/bind/zones/db.83.19.10
</source>
</source>



Revision as of 16:08, 1 August 2019

apt install bind9 bind9utils bind9-doc dnsutils
nano /etc/default/bind9
# run resolvconf?
RESOLVCONF=no

# startup options for the server
OPTIONS="-u bind -4"

nano /etc/bind/named.conf.options

acl "trusted" {
        10.19.83.1;   # gtw
        10.19.83.2;   # apn
        10.19.83.3;   # rpi, dns
        10.19.83.6;   # ceo
        10.19.83.10;  # mac
};

options {
        directory "/var/cache/bind";
        recursion yes;                 # enables resursive queries
        allow-recursion { trusted; };  # allows recursive queries from "trusted" clients
        listen-on { 10.19.83.3; };     # dns private IP address - listen on private network only
        allow-transfer { none; };      # disable zone transfers by default
        forward first;
        forwarders {
                8.8.8.8;
                8.8.4.4;
        };
        dnssec-validation auto;
        auth-nxdomain no;              # conform to RFC1035
        listen-on-v6 { any; };
};

nano /etc/bind/named.conf.local

zone "dev.shahed.biz" {
    type master;
    file "/etc/bind/zones/db.dev.shahed.biz"; # zone file path
};

zone "83.19.10.in-addr.arpa" {
    type master;
    file "/etc/bind/zones/db.83.19.10";       # 10.19.83.0/24 subnet
};
mkdir /etc/bind/zones
cp /etc/bind/db.local /etc/bind/zones/db.dev.shahed.biz
nano /etc/bind/zones/db.dev.shahed.biz
;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     dns.dev.shahed.biz. admin.dev.shahed.biz. (
                              3         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
; name servers - NS records
@       IN      NS      dns.dev.shahed.biz.
;
; name servers - A records
dns.dev.shahed.biz.        IN      A      10.19.83.3

; 10.19.83.0/24 - A records
gtw.dev.shahed.biz.        IN      A      10.19.83.1
apn.dev.shahed.biz.        IN      A      10.19.83.2
rpi.dev.shahed.biz.        IN      A      10.19.83.3
ceo.dev.shahed.biz.        IN      A      10.19.83.6
mac.dev.shahed.biz.        IN      A      10.19.83.10
cp /etc/bind/db.127 /etc/bind/zones/db.83.19.10
nano /etc/bind/zones/db.10.19.83
;
; BIND reverse data file for local loopback interface
;
$TTL    604800
@       IN      SOA     dns.dev.shahed.biz. admin.dev.shahed.biz. (
                              3         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
; name servers - NS records
@       IN      NS      dns.dev.shahed.biz.
;
; PTR Records
1.10    IN      PTR     gtw.dev.shahed.biz.    ; 10.19.83.1
2.10    IN      PTR     apn.dev.shahed.biz.    ; 10.19.83.2
3.10    IN      PTR     dns.dev.shahed.biz.    ; 10.19.83.3
3.10    IN      PTR     rpi.dev.shahed.biz.    ; 10.19.83.3
6.10    IN      PTR     ceo.dev.shahed.biz.    ; 10.19.83.6
10.10   IN      PTR     mac.dev.shahed.biz.    ; 10.19.83.10

nano /etc/resolv.conf

nameserver 10.19.83.3
nameserver 8.8.8.8
nameserver 8.8.4.4
search dev.shahed.biz

nano /etc/network/interfaces

dns-nameservers 10.19.83.3 8.8.8.8 8.8.4.4
dns-search dev.shahed.biz
/etc/init.d/bind9 restart
named-checkconf -z
named-checkzone dev.shahed.biz /etc/bind/zones/db.dev.shahed.biz
named-checkzone 83.19.10.in-addr.arpa /etc/bind/zones/db.83.19.10

References