Dokumen ini menjelaskan konsep, instalasi, konfigurasi, serta best practice untuk mengelola DNS server di Linux menggunakan Bind9 dan dnsmasq, termasuk penguatan keamanan, manajemen dari sisi server hingga client, serta rekomendasi penggunaan GUI untuk mempermudah administrasi DNS.
example.com
) menjadi alamat IP (contoh: 93.184.216.34
).sudo apt update
sudo apt install bind9 bind9-utils bind9-dnsutils -y
sudo apt update
sudo apt install dnsmasq -y
Edit file /etc/bind/named.conf.options
:
options {
directory "/var/cache/bind";
recursion yes;
allow-query { any; };
forwarders {
1.1.1.1;
8.8.8.8;
};
dnssec-validation auto;
auth-nxdomain no;
listen-on { any; };
};
Buat file /etc/bind/named.conf.local
:
zone "example.com" {
type master;
file "/etc/bind/zones/db.example.com";
};
Contoh zone file /etc/bind/zones/db.example.com
:
$TTL 604800
@ IN SOA ns1.example.com. admin.example.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns1.example.com.
@ IN A 192.168.1.10
ns1 IN A 192.168.1.10
www IN A 192.168.1.20
Reload konfigurasi:
sudo systemctl restart bind9
sudo systemctl enable bind9
Edit /etc/dnsmasq.conf
:
domain-needed
bogus-priv
no-resolv
server=1.1.1.1
server=8.8.8.8
listen-address=127.0.0.1,192.168.1.1
cache-size=1000
# DHCP optional
dhcp-range=192.168.1.50,192.168.1.150,12h
Restart service:
sudo systemctl restart dnsmasq
sudo systemctl enable dnsmasq
✅ Jalankan DNS di VM/container terisolasi.\
✅ Aktifkan DNSSEC untuk validasi query.\
✅ Batasi query recursive hanya untuk internal (Bind9 allow-query
).\
✅ Gunakan firewall (iptables/ufw/nftables) untuk filter port
53/tcp
dan 53/udp
.\
✅ Rutin update paket untuk patch keamanan.\
✅ Monitoring dengan dnstop
, netstat
, systemd journal
.\
✅ Backup zone file dengan versioning (Git/Ansible).
✅ Gunakan /etc/resolv.conf dengan DNS internal → external (failover).\ ✅ Implementasikan DNS over TLS (DoT) atau DNS over HTTPS (DoH) untuk keamanan tambahan.\ ✅ Cache lokal menggunakan dnsmasq.\ ✅ Untuk laptop/mobile, gunakan VPN dengan internal DNS.
Contoh /etc/resolv.conf
:
nameserver 192.168.1.10 # Internal DNS (Bind9)
nameserver 1.1.1.1 # Cloudflare fallback
nameserver 8.8.8.8 # Google DNS fallback
Mengelola DNS dengan CLI cukup kompleks, maka disarankan memakai GUI/Panel:\