Bind For Private Network DNS Server: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
Line 117: Line 117:
* [https://www.digitalocean.com/community/tutorials/how-to-configure-bind-as-a-private-network-dns-server-on-ubuntu-16-04 How To Configure BIND as a Private Network DNS Server on Ubuntu 16.04]
* [https://www.digitalocean.com/community/tutorials/how-to-configure-bind-as-a-private-network-dns-server-on-ubuntu-16-04 How To Configure BIND as a Private Network DNS Server on Ubuntu 16.04]
* [https://www.digitalocean.com/community/tutorials/how-to-configure-bind-as-a-private-network-dns-server-on-ubuntu-18-04 How To Configure BIND as a Private Network DNS Server on Ubuntu 18.04]
* [https://www.digitalocean.com/community/tutorials/how-to-configure-bind-as-a-private-network-dns-server-on-ubuntu-18-04 How To Configure BIND as a Private Network DNS Server on Ubuntu 18.04]
* [https://www.linuxbabe.com/ubuntu/set-up-authoritative-dns-server-ubuntu-18-04-bind9 Set Up Authoritative DNS Server on Ubuntu 18.04, 16.04 with BIND9]
* [http://bikramdhoju.com.np/network&system/DNS-Series-2/ Setting up Private DNS Server with BIND9]
* [http://bikramdhoju.com.np/network&system/DNS-Series-2/ Setting up Private DNS Server with BIND9]

Revision as of 08:59, 30 July 2019

nano /etc/bind/named.conf.options

acl "trusted" {
        19.83.10.1;   # gtw
        19.83.10.2;   # apn
        19.83.10.3;   # rpi, ns0
        19.83.10.6;   # ceo
        19.83.10.10;  # mac
};

options {
        directory "/var/cache/bind";
        recursion yes;                 # enables resursive queries
        allow-recursion { trusted; };  # allows recursive queries from "trusted" clients
        listen-on { 19.83.10.3; };     # ns0 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 "19.83.10.in-addr.arpa" {
    type master;
    file "/etc/bind/zones/db.19.83.10";       # 19.83.10.0/24 subnet
};

nano /etc/bind/zones/db.dev.shahed.biz

;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns0.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      ns0.dev.shahed.biz.
;
; name servers - A records
ns0.dev.shahed.biz.        IN      A      19.83.10.3

; 19.83.10.0/24 - A records
gtw.dev.shahed.biz.        IN      A      19.83.10.1
apn.dev.shahed.biz.        IN      A      19.83.10.2
rpi.dev.shahed.biz.        IN      A      19.83.10.3
ceo.dev.shahed.biz.        IN      A      19.83.10.6
mac.dev.shahed.biz.        IN      A      19.83.10.10

nano /etc/bind/zones/db.19.83.10

;
; BIND reverse data file for local loopback interface
;
$TTL    604800
@       IN      SOA     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      ns0.dev.shahed.biz.
;
; PTR Records
1.10    IN      PTR     gtw.dev.shahed.biz.    ; 19.83.10.1
2.10    IN      PTR     apn.dev.shahed.biz.    ; 19.83.10.2
3.10    IN      PTR     ns0.dev.shahed.biz.    ; 19.83.10.3
3.10    IN      PTR     rpi.dev.shahed.biz.    ; 19.83.10.3
6.10    IN      PTR     ceo.dev.shahed.biz.    ; 19.83.10.6
10.10   IN      PTR     mac.dev.shahed.biz.    ; 19.83.10.10

nano /etc/resolv.conf

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

nano /etc/network/interfaces

dns-nameservers 19.83.10.3 8.8.8.8 8.8.4.4
dns-search dev.shahed.biz
/etc/init.d/bind9 restart
named-checkconf
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

References