Cara Konfigurasi DNS di Debian 12
DNS (Domain Name System) adalah sistem yang menerjemahkan nama domain menjadi alamat IP yang dapat dibaca oleh komputer. Dengan DNS, pengguna dapat mengakses situs web tanpa perlu mengingat alamat IP server secara langsung. Pada kali ini kita akan belajar bersama-sama bagaimana cara mengkonfigurasi DNS di Debian.
Cara Konfigurasi DNS:
1. Login sebagai user root kemudian install paket bind9 dengan mengetikkan perintah berikut, jika muncul pertanyaan [Y/n] ketikkan Y lalu enter.
apt -y install bind9
Jika pada penginstalan muncul perintah untuk memasukan disk, ganti disk sesuai yang ada di tampilan layar
2. Jika pada penginstalan paket terjadi error maka ketikkan perintah berikut, jika muncul pertanyaan [Y/n] ketikkan Y lalu enter.
apt --fix-broken install
cd /etc/bind
4. Ketikkan perintah ls untuk melihat file yang ada di bind, lalu copy file db.local dan db.127 dengan perintah cp dan rubah sesuai dengan nama yang diinginkan.
6. Lalu konfigurasikan seperti berikut ini.
;
BIND data file for local loopback interface
;
$TTL 604800
@ IN SDA domain.com. root.domain.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS domain.com.
@ IN A 192.168.10.1
ns IN A 192.168.10.1
BIND data file for local loopback interface
;
$TTL 604800
@ IN SDA domain.com. root.domain.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS domain.com.
@ IN A 192.168.10.1
ns IN A 192.168.10.1
7. Masuk ke file db.reverse dengan perintah berikut.
nano db.reverse
8. Kemudian konfigurasikan seperti berikut ini.
;
; BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN SOA domain.com. root.domain.com. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS domain.com.
1 IN PTR domain.com.
; BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN SOA domain.com. root.domain.com. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS domain.com.
1 IN PTR domain.com.
9. Setelah itu masuk ke file named.conf.options.
nano named.conf.options
10. Konfigurasikan menjadi seperti ini.
options {
directory "/var/cache/bind";
directory "/var/cache/bind";
// If there is a firewall between you and nameservers you want
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk. See http://www.kb.cert.org/vuls/id/800113
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk. See http://www.kb.cert.org/vuls/id/800113
// If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0's placeholder.
forwarders {
192.168.10.1;
};
//=================================
// If BIND logs error messages about the root key being expired,
// you will need to update your keys. See https://www.isc.org/bind-keys
//=================================
dnssec-validation no;
listen-on-v6 { any; };
};
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0's placeholder.
forwarders {
192.168.10.1;
};
//=================================
// If BIND logs error messages about the root key being expired,
// you will need to update your keys. See https://www.isc.org/bind-keys
//=================================
dnssec-validation no;
listen-on-v6 { any; };
};
11. Setelah itu masuk ke file named.conf.local.
nano named.conf.local
12. Lalu tambahkan teks seperti berikut ini.
//
// Do any local configuration here
//
// Do any local configuration here
//
// Consider adding the 1918 zones here, if they are not used in your
// organization
// include "/etc/bind/zones.rfc1918";
// organization
// include "/etc/bind/zones.rfc1918";
zone "domain.com" {
type master;
file "/etc/bind/db.forward";
};
zone "10.168.192.in-addr.arpa" {
type master;
file "/etc/bind/db.reverse";
};
type master;
file "/etc/bind/db.forward";
};
zone "10.168.192.in-addr.arpa" {
type master;
file "/etc/bind/db.reverse";
};
13. Kemudian masuk ke file resolv.conf.
nano /etc/resolv.conf
14. Tambahkan atau edit seperti berikut pada file resolv.
search domain.com
nameserver 192.168.10.1
nameserver 192.168.10.1
15. Jika sudah install paket dnsutils dan restart service bind9.
apt -y install dnsutils
systemctl restart bind9
16. Lalu lakukan pengujian dengan perintah nslookup domain.com.
nslookup domain.com
17. Kemudian lakukan pengujian nslookup 192.168.10.1.
nslookup 192.168.10.1
Maka akan muncul seperti ini, jika terjadi error pada pengetesan yang pertama dan kedua cek kembali pada konfigurasi file-nya.
Itu dia cara konfigurasi DNS di debian 12, semoga cara ini bisa membantu dan bermanfaat, jika ada pertanyaan jangan ragu untuk bertanya di kolom komentar, terimakasih.
Gabung dalam percakapan