https://www.itzgeek.com/debian/configure-dns-server-on-debian-9.html
Instalacja bind9
# apt-get install -y bind9 bind9utils bind9-doc dnsutils
Globalna konfiguracja
# cd /etc/bind/ # less named.conf - nie zmieniany # nano named.conf.local - plik do edycji
Definicja strefy – named.conf.local
zone "revite.pl" IN { //Domain name type master; //Primary DNS file "/etc/bind/fwd.revite.pl.db"; //Forward lookup file allow-update { none; }; //primary DNS - none };
Strefa odwrotna – named.conf.local
zone "1.168.192.in-addr.arpa" IN { //network - reverse order type master; file "/etc/bind/rev.revite.pl.db"; //Reverse lookup file allow-update { none; }; };
Skopiowanie struktury do pliku strefy
# cp /etc/bind/db.local /etc/bind/fwd.revite.pl.db
# nano /etc/bind/fwd.revite.pl.db
$TTL    604800
@       IN      SOA     ns1.revite.pl. admin.revite.pl. (
                             20         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.
@       IN      A       127.0.0.1
@       IN      AAAA    ::1
;Name Server Information
       IN      NS      ns1.revite.pl.
    ;  IN      NS      ns2.itzgeek.local.   // Secondary
;IP address of Name Server
ns1     IN      A       192.168.1.10
;ns2    IN      A       165.121.213.107  // Secondary
;Mail Exchanger
revite.pl.      IN     MX   10   mail.revite.pl.
;A - Record HostName To Ip Address
www     IN       A      192.168.1.105
mail    IN       A      192.168.1.105
;CNAME record
ftp     IN      CNAME   www
Skopiowanie struktury strefy odwrotnej
# cp /etc/bind/db.127 /etc/bind/rev.revite.pl.db
# nano /etc/bind/rev.revite.pl.db
Plik strefy odwrotnej
;
; BIND reverse data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns1.revitesite.pl. admin.revitesite.pl. (
                             20         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.
1.0.0   IN      PTR     localhost.
;Name Server Information
       IN      NS     ns1.revitesite.pl.
;Reverse lookup for Name Server
117     IN      PTR     ns1.revitesite.pl.
;PTR Record IP address to HostName
117      IN      PTR     www.revitesite.pl.
117      IN      PTR     mail.revitesite.pl.
Sprawdzenie konfiguracji – jeśli ok nic nie zwróci
# named-checkconf
Sprawdzenie stref
# named-checkzone revite.pl /etc/bind/fwd.revite.pl.db zone revite.pl/IN: loaded serial 20 OK
# named-checkzone 1.168.192.in-addr.arpa /etc/bind/rev.revite.pl.db zone 1.168.192.in-addr.arpa/IN: loaded serial 20 OK
Uruchomienia Bind9
# systemctl restart bind9 # systemctl enable bind9 - uruchomi się po restarcie maszyny
Status
# systemctl status bind9
● bind9.service - BIND Domain Name Server
   Loaded: loaded (/lib/systemd/system/bind9.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2018-08-25 11:22:43 BST; 1min 29s ago
     Docs: man:named(8)
 Main PID: 13828 (named)
    Tasks: 4 (limit: 4915)
   CGroup: /system.slice/bind9.service
           └─13828 /usr/sbin/named -f -u bind