Debian 11: Install dan Konfigurasi DNS: Perbedaan antara revisi

Dari Dokumentasi Robie
Loncat ke navigasi Loncat ke pencarian
Tidak ada ringkasan suntingan
Tidak ada ringkasan suntingan
 
(7 revisi perantara oleh pengguna yang sama tidak ditampilkan)
Baris 6: Baris 6:
  apt update
  apt update
  apt install bind9 bind9utils bind9-doc
  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==
==Konfigurasi Local File==
Baris 19: Baris 11:
Edit
Edit


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


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


  zone "robiehakim.ac.id" {
  zone "robiehakim.net" {
     type master;
     type master;
     file "/etc/bind/zones/db.robiehakim.ac.id";   # zone file path
     file "/etc/bind/forward";
     allow-transfer { 10.128.20.12; };            # ns2 private IP address - secondary
      
  };
  };


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


==Buat Forward Zone File==
== Mengcopy dan Edit file konfigurasi ==
Pertama copy file db.local dengan mengetikkan perintah


Buat dan edit
#cp /etc/bind/db.local /etc/binforward


sudo mkdir /etc/bind/zones
lalu edit file bagian ini
cd /etc/bind/zones
sudo cp ../db.local ./db.robiehakim.ac.id
sudo nano /etc/bind/zones/db.robiehakim.ac.id
 
Isi awalnya kira-kira


;
; BIND data file for local loopback interface
;
  $TTL    604800
  $TTL    604800
  @      IN      SOA    localhost. root.localhost. (
  @      IN      SOA    robiehakim.net. root.robiehakim.net. (
                               2        ; Serial
                               2        ; Serial
                           604800        ; Refresh
                           604800        ; Refresh
Baris 54: Baris 46:
                           604800 )      ; Negative Cache TTL
                           604800 )      ; Negative Cache TTL
  ;
  ;
  @      IN      NS      localhost.     ; delete this line
  @      IN      NS      robiehakim.net.
  @      IN      A      127.0.0.1      ; delete this line
  @      IN      A      12.13.14.32 #(sesuaikan dengan ip server / vm)
  @      IN      AAAA    ::1             ; delete this line
  @      IN      AAAA    ::1
 
 
 
#cp /etc/bind/db.123 /etc/bin/reverse


Dapat kita ubah menjadi, misalnya,
lalu edit file bagian ini


;
; BIND reverse data file for local loopback interface
;
  $TTL    604800
  $TTL    604800
  @      IN      SOA    ns1.darmajaya.ac.id. admin.darmajaya.ac.id. (
  @      IN      SOA    robiehakim.net. root.robiehakim.net. (
                  3    ; Serial
                              1        ; Serial
              604800     ; Refresh
                          604800         ; Refresh
              86400     ; Retry
                          86400         ; Retry
            2419200     ; Expire
                        2419200         ; Expire
              604800 )   ; Negative Cache TTL
                          604800 )       ; Negative Cache TTL
  ;
  ;
  ; name servers - NS records
  @       IN      NS      robiehakim.net.
       IN      NS      ns.robiehakim.ac.id.
  32     IN      PTR    robiehakim.net.
   
; name servers - A records
ns.robiehakim.ac.id.          IN     A      12.13.14.5
; 192.168.1.0/16 - A records
www.darmajaya.ac.id.        IN      A      12.13.14.5
darmajaya.ac.id.            IN      A      12.13.14.5


==Cek Syntax Konfigurasi BIND==


Jalankan perintah
==Tambahkan IP Server ke file resolve.conf==


  sudo named-checkconf
  #nano /etc/resolv.conf


Cek zone tertentu


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


Pastikan tidak ada error, keluar
OK


==Restart BIND==
==Restart BIND==
Baris 97: Baris 83:
Restart
Restart


  sudo service bind9 restart
  systemctl restart bind9
sudo systemctl start bind9
 
Lihat hasil dengan mengetikkan perintah di terminal
Lihat hasil dengan mengetikkan perintah di terminal




<code>dig robiehakim.ac.id @localhost (enter)</code>
dig robiehakim.net @localhost (enter)


<code>dig www.robiehakim.ac.id @localhost (enter)</code>
; <<>> DiG 9.16.44-Debian <<>> robiehakim.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56404
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 59973bf45d5296e50100000065a936f48d3598f288cbd081 (good)
;; QUESTION SECTION:
;robiehakim.net. IN A
;; ANSWER SECTION:
robiehakim.net. 604800 IN A 12.13.14.32
;; Query time: 0 msec
;; SERVER: 12.13.14.32#53(12.13.14.32)
;; WHEN: Thu Jan 18 21:34:28 WIB 2024
;; MSG SIZE  rcvd: 87
 
 
nslookup robiehakim.net @localhost (enter)
 
Server: 12.13.14.32
Address: 12.13.14.32#53
Name: robiehakim.net
Address: 12.13.14.32
Name: robiehakim.net
Address: ::1
[[Kategori:Linux]]

Revisi terkini sejak 18 Januari 2024 14.58

Install BIND

install BIND

sudo su
apt update
apt install bind9 bind9utils bind9-doc

Konfigurasi Local File

Edit

sudo nano /etc/bind/named.conf

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

zone "robiehakim.net" {
    type master;
    file "/etc/bind/forward";
    
};
zone "14.13.12.in-addr.arpa" {
    type master;
    notify no;
    file "/etc/bind/reverse";
    
};

Mengcopy dan Edit file konfigurasi

Pertama copy file db.local dengan mengetikkan perintah

#cp /etc/bind/db.local /etc/binforward

lalu edit file bagian ini

;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     robiehakim.net. root.robiehakim.net. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      robiehakim.net.
@       IN      A       12.13.14.32 #(sesuaikan dengan ip server / vm)
@       IN      AAAA    ::1


#cp /etc/bind/db.123 /etc/bin/reverse

lalu edit file bagian ini

;
; BIND reverse data file for local loopback interface
;
$TTL    604800
@       IN      SOA     robiehakim.net. root.robiehakim.net. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      robiehakim.net.
32      IN      PTR     robiehakim.net.


Tambahkan IP Server ke file resolve.conf

#nano /etc/resolv.conf


nameserver 12.13.14.32


Restart BIND

Restart

systemctl restart bind9

Lihat hasil dengan mengetikkan perintah di terminal


dig robiehakim.net @localhost (enter)
; <<>> DiG 9.16.44-Debian <<>> robiehakim.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56404
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 59973bf45d5296e50100000065a936f48d3598f288cbd081 (good)
;; QUESTION SECTION:
;robiehakim.net.			IN	A

;; ANSWER SECTION:
robiehakim.net.		604800	IN	A	12.13.14.32 

;; Query time: 0 msec
;; SERVER: 12.13.14.32#53(12.13.14.32)
;; WHEN: Thu Jan 18 21:34:28 WIB 2024
;; MSG SIZE  rcvd: 87


nslookup robiehakim.net @localhost (enter)
Server:		12.13.14.32
Address:	12.13.14.32#53

Name:	robiehakim.net
Address: 12.13.14.32
Name:	robiehakim.net
Address: ::1