root@srv1:~# apt install bind9
root@srv1:~# ufw allow 53
root@srv1:~# nano /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
ethernets:
enp0s3:
dhcp4: false
addresses: [10.0.2.254/24]
gateway4: 10.0.2.1
nameservers:
search: [domainmu.com]
addresses: [10.0.2.254, 10.0.2.1]
version: 2
Konfigurasi Resolv.conf
root@srv1:~# nano /etc/resolv.conf
# operation for /etc/resolv.conf
nameserver 10.0.2.254
nameserver 10.0.2.1
options edns0
search domainmu.com
Konfigurasi hosts
root@srv1:~# nano /etc/hosts
127.0.0.1 localhost
127.0.1.1 srv1
10.0.2.254 domainmu.com
Edit file /etc/bind/named.conf.local lalu Tambahkan script dibawah ini.
root@srv1:~# nano /etc/bind/named.conf.local
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
zone "domainmu.com" {
type master;
file "/etc/bind/db.domainmu";
};
root@srv1:~# cp /etc/bind/db.local /etc/bind/db.domainmu
Lalu edit seperti dibawah ini.
root@srv1:~# nano /etc/bind/db.domainmu
;
; BIND data file for PT. KAMU
;
$TTL 604800
@ IN SOA ns.domainmu.com. root.domainmu.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.domainmu.com.
@ IN A 10.0.2.254
@ IN MX 10 mail.domainmu.com.
ns IN A 10.0.2.254
www IN CNAME ns
mail IN A 10.0.2.254
root@srv1:~# systemctl restart bind9.service
Edit file /etc/bind/named.conf.local untuk menambahkan zone pada Primary Server
root@srv1:~# nano /etc/bind/named.conf.local
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
zone "domainmu.com" {
type master;
file "/etc/bind/db.domainmu";
};
zone "22.168.192.in-addr.arpa" {
type master;
file "/etc/bind/db.192";
};
root@srv1:~# cp /etc/bind/db.127 /etc/bind/db.192
root@srv1:~# nano /etc/bind/db.192
;
; BIND reverse data file for PT. KAMU
;
$TTL 604800
@ IN SOA ns.domainmu.com. root.domainmu.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.domainmu.com.
1 IN PTR ns.domainmu.com.
1 IN PTR www.domainmu.com
1 IN PTR mail.domainmu.com
root@srv1:~# systemctl restart bind9.service
root@srv1:~# nano /etc/bind/named.conf.options
// 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 {
8.8.8.8;
8.8.4.4;
};
root@srv1:~# systemctl restart bind9.service