Debian 11: Install dan Konfigurasi DNS

Dari Dokumentasi Robie
Loncat ke navigasi Loncat ke pencarian

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