BIND: Instalasi dan Konfigurasi

From OnnoWiki
Jump to navigation Jump to search

Install BIND

install BIND

sudo su
apt update
apt install bind9 bind9utils bind9-doc

Setup hanya untuk IPv4 (-4) jika dibutuhkan

vi /etc/default/bind9

Tambahkan (-4)

OPTIONS="-4 -u bind"

Konfigurasi Local File

Edit

sudo vi /etc/bind/named.conf.local

Di file ini kita bisa tambahkan forward dan revese zone (asumsi subnet 192.168.1.0/24) dari sebuah domain, contoh

zone "darmajaya.ac.id" {
    type master;
    file "/etc/bind/zones/db.darmajaya.ac.id";   # zone file path
    allow-transfer { 10.128.20.12; };            # ns2 private IP address - secondary
};
zone "1.168.192.in-addr.arpa" {
    type master;
    file "/etc/bind/zones/db.192.168.1";   # 192.168.1.0/24 subnet
    allow-transfer { 10.128.20.12; };      # ns2 private IP address - secondary
};

Buat Forward Zone File

Buat dan edit

sudo mkdir /etc/bind/zones
cd /etc/bind/zones
sudo cp ../db.local ./db.darmajaya.ac.id
sudo vi /etc/bind/zones/db.darmajaya.ac.id

Isi awalnya kira-kira

$TTL    604800
@       IN      SOA     localhost. root.localhost. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.      ; delete this line
@       IN      A       127.0.0.1       ; delete this line
@       IN      AAAA    ::1             ; delete this line

Dapat kita ubah menjadi, misalnya,

$TTL    604800
@       IN      SOA     ns1.darmajaya.ac.id. admin.darmajaya.ac.id. (
                  3     ; Serial
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL
;
; name servers - NS records
     IN      NS      ns1.darmajaya.ac.id.
     IN      NS      ns2.darmajaya.ac.id. 

; name servers - A records
ns1.darmajaya.ac.id.          IN      A       192.168.1.10
ns2.darmajaya.ac.id.          IN      A       192.168.4.10

; 192.168.1.0/16 - A records
www.darmajaya.ac.id.        IN      A      192.168.1.10
www.darmajaya.ac.id.        IN      A      192.168.4.10
darmajaya.ac.id.            IN      A      192.168.1.10
darmajaya.ac.id.            IN      A      192.168.4.10

Buat Reverse Zone File

Buat dan edit

cd /etc/bind/zones
sudo cp ../db.127 ./db.192.168
sudo vi /etc/bind/zones/db.192.168

Awalnya akan berisi kira-kira

$TTL    604800
@       IN      SOA     localhost. root.localhost. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.      ; delete this line
1.0.0   IN      PTR     localhost.      ; delete this line

Ubah menjadi kira-kira,

$TTL    604800
@       IN      SOA     darmajaya.ac.id. admin.darmajaya.ac.id. (
                              3         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
; name servers
      IN      NS      ns1.darmajaya.ac.id.
      IN      NS      ns2.darmajaya.ac.id.

; PTR Records
10.1 IN      PTR     ns1.darmajaya.ac.id.    ; 192.168.1.10
10.4 IN      PTR     ns2.darmajaya.ac.id.    ; 192.168.4.10
10.1 IN      PTR     www.darmajaya.ac.id.    ; 192.168.1.10
10.4 IN      PTR     www.darmajaya.ac.id.    ; 192.168.4.10
10.1 IN      PTR     darmajaya.ac.id.        ; 192.168.1.10
10.4 IN      PTR     darmajaya.ac.id.        ; 192.168.4.10

Cek Syntax Konfigurasi BIND

Jalankan perintah

sudo named-checkconf

Cek zone tertentu

sudo named-checkzone darmajaya.ac.id db.darmajaya.ac.id
sudo named-checkzone 168.192.in-addr.arpa /etc/bind/zones/db.192.168

Pastikan tidak ada error, keluar

OK

Restart BIND

Restart

sudo service bind9 restart
sudo systemctl start bind9

Pranala Menarik