Difference between revisions of "BIND: Memasukan Record"

From OnnoWiki
Jump to navigation Jump to search
(Created page with "==Konfigurasi Local File== Edit sudo vi /etc/bind/named.conf.local Di file ini kita bisa tambahkan forward dan revese zone dari sebuah domain, contoh zone "nyc3.example....")
 
 
(10 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
Di file ini kita bisa tambahkan forward dan revese zone dari sebuah domain, contoh
 
Di file ini kita bisa tambahkan forward dan revese zone dari sebuah domain, contoh
  
  zone "nyc3.example.com" {
+
  zone "nyc3.contoh.web.id" {
 
     type master;
 
     type master;
     file "/etc/bind/zones/db.nyc3.example.com"; # zone file path
+
     file "/etc/bind/zones/db.nyc3.contoh.web.id"; # zone file path
     allow-transfer { 10.128.20.12; };         # ns2 private IP address - secondary
+
     allow-transfer {
 +
        10.128.20.12;
 +
        2345::2;
 +
        };             # ns2 private IP address - secondary
 
  };
 
  };
  
Asumsi private subnet 10.128.0.0/16, reverse zone- adalah,
+
Asumsi subnet 10.128.0.0/16, reverse zone- adalah,
  
 
  zone "128.10.in-addr.arpa" {
 
  zone "128.10.in-addr.arpa" {
 
     type master;
 
     type master;
 
     file "/etc/bind/zones/db.10.128";  # 10.128.0.0/16 subnet
 
     file "/etc/bind/zones/db.10.128";  # 10.128.0.0/16 subnet
     allow-transfer { 10.128.20.12; };  # ns2 private IP address - secondary
+
     allow-transfer {
 +
        10.128.20.12;
 +
        2345::2;
 +
        };  # ns2 private IP address - secondary
 
  };
 
  };
  
 +
Asumsi subnet 2345::/64, reverse zone- adalah,
 +
 +
zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.5.4.3.2.ip6.arpa." {
 +
    type master;
 +
    file "/etc/bind/zones/db.5.4.3.2";  # 2345::/64 subnet
 +
    allow-transfer {
 +
        10.128.20.12;
 +
        2345::2;
 +
        };  # ns2 private IP address - secondary
 +
};
  
 
==Buat Forward Zone File==
 
==Buat Forward Zone File==
Line 28: Line 44:
 
  sudo mkdir /etc/bind/zones
 
  sudo mkdir /etc/bind/zones
 
  cd /etc/bind/zones
 
  cd /etc/bind/zones
  sudo cp ../db.local ./db.nyc3.example.com
+
  sudo cp ../db.local ./db.nyc3.contoh.web.id
  sudo vi /etc/bind/zones/db.nyc3.example.com
+
  sudo vi /etc/bind/zones/db.nyc3.contoh.web.id
  
 
Isi awalnya kira-kira
 
Isi awalnya kira-kira
Line 48: Line 64:
  
 
  $TTL    604800
 
  $TTL    604800
  @      IN      SOA    ns1.nyc3.example.com. admin.nyc3.example.com. (
+
  @      IN      SOA    ns1.nyc3.contoh.web.id. admin.nyc3.contoh.web.id. (
 
                   3      ; Serial
 
                   3      ; Serial
 
               604800    ; Refresh
 
               604800    ; Refresh
Line 56: Line 72:
 
  ;
 
  ;
 
  ; name servers - NS records
 
  ; name servers - NS records
       IN      NS      ns1.nyc3.example.com.
+
       IN      NS      ns1.nyc3.contoh.web.id.
       IN      NS      ns2.nyc3.example.com.  
+
       IN      NS      ns2.nyc3.contoh.web.id.  
 
   
 
   
 
  ; name servers - A records
 
  ; name servers - A records
  ns1.nyc3.example.com.          IN      A      10.128.10.11
+
  ns1.nyc3.contoh.web.id.          IN      A      10.128.10.11
  ns2.nyc3.example.com.          IN      A      10.128.20.12
+
  ns2.nyc3.contoh.web.id.          IN      A      10.128.20.12
 
   
 
   
 
  ; 10.128.0.0/16 - A records
 
  ; 10.128.0.0/16 - A records
  host1.nyc3.example.com.        IN      A      10.128.100.101
+
  host1.nyc3.contoh.web.id.        IN      A      10.128.100.101
  host2.nyc3.example.com.        IN      A      10.128.200.102
+
  host2.nyc3.contoh.web.id.        IN      A      10.128.200.102
 +
host1.nyc3.contoh.web.id.        IN      AAAA  2345::101
 +
host2.nyc3.contoh.web.id.        IN      AAAA  2345::102
  
 
==Buat Reverse Zone File==
 
==Buat Reverse Zone File==
Line 91: Line 109:
  
 
  $TTL    604800
 
  $TTL    604800
  @      IN      SOA    nyc3.example.com. admin.nyc3.example.com. (
+
  @      IN      SOA    nyc3.contoh.web.id. admin.nyc3.contoh.web.id. (
 
                               3        ; Serial
 
                               3        ; Serial
 
                           604800        ; Refresh
 
                           604800        ; Refresh
Line 98: Line 116:
 
                           604800 )      ; Negative Cache TTL
 
                           604800 )      ; Negative Cache TTL
 
  ; name servers
 
  ; name servers
       IN      NS      ns1.nyc3.example.com.
+
       IN      NS      ns1.nyc3.contoh.web.id.
       IN      NS      ns2.nyc3.example.com.
+
       IN      NS      ns2.nyc3.contoh.web.id.
 
   
 
   
 
  ; PTR Records
 
  ; PTR Records
  11.10  IN      PTR    ns1.nyc3.example.com.    ; 10.128.10.11
+
  11.10  IN      PTR    ns1.nyc3.contoh.web.id.    ; 10.128.10.11
  12.20  IN      PTR    ns2.nyc3.example.com.    ; 10.128.20.12
+
  12.20  IN      PTR    ns2.nyc3.contoh.web.id.    ; 10.128.20.12
  101.100 IN      PTR    host1.nyc3.example.com.  ; 10.128.100.101
+
  101.100 IN      PTR    host1.nyc3.contoh.web.id.  ; 10.128.100.101
  102.200 IN      PTR    host2.nyc3.example.com.  ; 10.128.200.102
+
  102.200 IN      PTR    host2.nyc3.contoh.web.id.  ; 10.128.200.102
 +
 
 +
==Buat Reverse Zone IPv6==
 +
 
 +
Buat dan edit
 +
 
 +
    cd /etc/bind/zones
 +
    sudo cp ../db.127 ./db.5.4.3.2
 +
    sudo vi /etc/bind/zones/db.5.4.3.2
 +
 
 +
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,
 +
 
 +
 
 +
 
 +
;
 +
; 2345::1/64
 +
;
 +
; Zone file built with the IPv6 Reverse DNS zone builder
 +
; http://rdns6.com/
 +
;
 +
$TTL 1h ; Default TTL
 +
@ IN SOA nyc3.contoh.web.id. admin.nyc3.contoh.web.id. (
 +
2019022001 ; serial
 +
1h ; slave refresh interval
 +
15m ; slave retry interval
 +
1w ; slave copy expire time
 +
1h ; NXDOMAIN cache time
 +
)
 +
 +
;
 +
; domain name servers
 +
;
 +
@ IN NS ns1.nyc3.contoh.web.id.
 +
@ IN NS ns2.nyc3.contoh.web.id.
 +
 +
; IPv6 PTR entries
 +
1.0.1    IN    PTR    host1.nyc3.contoh.web.id.
 +
2.0.1    IN    PTR    host2.nyc3.contoh.web.id.
  
 
==Cek Syntax Konfigurasi BIND==
 
==Cek Syntax Konfigurasi BIND==
Line 115: Line 183:
 
Cek zone tertentu
 
Cek zone tertentu
  
  sudo named-checkzone nyc3.example.com db.nyc3.example.com
+
  sudo named-checkzone nyc3.contoh.web.id db.nyc3.contoh.web.id
 
  sudo named-checkzone 128.10.in-addr.arpa /etc/bind/zones/db.10.128
 
  sudo named-checkzone 128.10.in-addr.arpa /etc/bind/zones/db.10.128
 +
sudo named-checkzone 5.4.3.2.ip6.arpa /etc/bind/zones/db.5.4.3.2
  
 
Pastikan tidak ada error
 
Pastikan tidak ada error

Latest revision as of 08:36, 28 February 2019

Konfigurasi Local File

Edit

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

Di file ini kita bisa tambahkan forward dan revese zone dari sebuah domain, contoh

zone "nyc3.contoh.web.id" {
    type master;
    file "/etc/bind/zones/db.nyc3.contoh.web.id"; # zone file path
    allow-transfer {
        10.128.20.12;
        2345::2;
        };             # ns2 private IP address - secondary
};

Asumsi subnet 10.128.0.0/16, reverse zone- adalah,

zone "128.10.in-addr.arpa" {
    type master;
    file "/etc/bind/zones/db.10.128";  # 10.128.0.0/16 subnet
    allow-transfer {
        10.128.20.12;
        2345::2;
        };  # ns2 private IP address - secondary
};

Asumsi subnet 2345::/64, reverse zone- adalah,

zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.5.4.3.2.ip6.arpa." {
    type master;
    file "/etc/bind/zones/db.5.4.3.2";  # 2345::/64 subnet
    allow-transfer {
        10.128.20.12;
        2345::2;
        };  # 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.nyc3.contoh.web.id
sudo vi /etc/bind/zones/db.nyc3.contoh.web.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.nyc3.contoh.web.id. admin.nyc3.contoh.web.id. (
                  3       ; Serial
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL
;
; name servers - NS records
     IN      NS      ns1.nyc3.contoh.web.id.
     IN      NS      ns2.nyc3.contoh.web.id. 

; name servers - A records
ns1.nyc3.contoh.web.id.          IN      A       10.128.10.11
ns2.nyc3.contoh.web.id.          IN      A       10.128.20.12

; 10.128.0.0/16 - A records
host1.nyc3.contoh.web.id.        IN      A      10.128.100.101
host2.nyc3.contoh.web.id.        IN      A      10.128.200.102
host1.nyc3.contoh.web.id.        IN      AAAA   2345::101
host2.nyc3.contoh.web.id.        IN      AAAA   2345::102

Buat Reverse Zone File

Buat dan edit

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

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     nyc3.contoh.web.id. admin.nyc3.contoh.web.id. (
                              3         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
; name servers
      IN      NS      ns1.nyc3.contoh.web.id.
      IN      NS      ns2.nyc3.contoh.web.id.

; PTR Records
11.10   IN      PTR     ns1.nyc3.contoh.web.id.    ; 10.128.10.11
12.20   IN      PTR     ns2.nyc3.contoh.web.id.    ; 10.128.20.12
101.100 IN      PTR     host1.nyc3.contoh.web.id.  ; 10.128.100.101
102.200 IN      PTR     host2.nyc3.contoh.web.id.  ; 10.128.200.102

Buat Reverse Zone IPv6

Buat dan edit

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

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,


;
; 2345::1/64
;
; Zone file built with the IPv6 Reverse DNS zone builder
; http://rdns6.com/
;
$TTL 1h	; Default TTL
@	IN	SOA	nyc3.contoh.web.id.	admin.nyc3.contoh.web.id. (
	2019022001	; serial
	1h		; slave refresh interval
	15m		; slave retry interval
	1w		; slave copy expire time
	1h		; NXDOMAIN cache time
	)

;
; domain name servers
;
@	IN	NS	ns1.nyc3.contoh.web.id.
@	IN	NS	ns2.nyc3.contoh.web.id.

; IPv6 PTR entries
1.0.1    IN    PTR    host1.nyc3.contoh.web.id.
2.0.1    IN    PTR    host2.nyc3.contoh.web.id.

Cek Syntax Konfigurasi BIND

Jalankan perintah

sudo named-checkconf

Cek zone tertentu

sudo named-checkzone nyc3.contoh.web.id db.nyc3.contoh.web.id
sudo named-checkzone 128.10.in-addr.arpa /etc/bind/zones/db.10.128
sudo named-checkzone 5.4.3.2.ip6.arpa /etc/bind/zones/db.5.4.3.2

Pastikan tidak ada error

Restart BIND

Restart

   sudo service bind9 restart


Pranala Menarik