TMA 6.1: Konfigurasi DNS Record di Ubuntu Server dan Pengetesan di Alpine Linux

1. Masuk sebagai user root
$ sudo su
2. Lakukan konfigurasi network dengan melakukan edit pada /etc/netplan/50-cloud-init.yaml
# nano /etc/netplan/50-cloud-init.yaml
3. Update repo
# apt update
4. install Bind9 dan dnsutils
# apt install bind9 dnsutils -y
5. Masuk kedalam direktori /etc/bind
# cd /etc/bind
6. Kemudian lihat isi dalam direktori tsb
# ls
7.Buat file zone untuk domain
cp db.local db.smk-angkasa.sch.id
cp db.127 db.1
8. Lakukan konfigurasi pada forward zone
nano db.smk-angkasa.sch.id
Buat seperti ini namun sesuaikan domain dan ip anda
;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     smk-angkasa.sch.id. root.smk-angkasa.sch.id. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      smk-angkasa.sch.id.
@       IN      A       10.10.22.1
ns1     IN      A       10.10.22.1
www     IN      A       10.10.22.1
web     IN      CNAME   www.smk-angkasa.sch.id.
@       IN      TXT     "SMK Dharma Bahari DNS Server Testing"
9. Kemudian buat konfigurasi reverse zone
 nano db.1
edit output menjadi seperti dibawah (sesuaikan dengan domain dan ip milik anda)
;
; BIND reverse data file for local loopback interface
;
$TTL	604800
@	IN	SOA	smk-angkasa.sch.id. root.smk-angkasa.sch.id. (
			      1		; Serial
			 604800		; Refresh
			  86400		; Retry
			2419200		; Expire
			 604800 )	; Negative Cache TTL
;
@	IN	NS	smk-angkasa.sch.id.
1	IN	PTR	ns1.smk-angkasa.sch.id.
1	IN	PTR	smk-angkasa.sch.id.
1	IN	PTR	www.smk-angkasa.sch.id.
10. Tambahkan konfigurasi zona di named.conf.local
 # nano named.conf.local
edit output
//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

zone "smk-angkasa.sch.id" {
           type master;
           file "/etc/bind/db.smk-angkasa.sch.id";
};

zone "22.10.10.in-addr.arpa" {
           type master;
           file "/etc/bind/db.1";
};
11. Selanjutnya konfigurasi resolv.conf
 nano named.conf.options
edit output
options {
        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

        // 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;
        };

        //========================================================================
        // 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; };
};
12. Konfigurasi resolv.conf
 nano /etc/resolv.conf
edit output
nameserver 10.10.22.1
options edns0 trust-ad
search smk-angkasa.sch.id
13. Lakukan restart bind9 serta cek statusnya (harus aktif)
systemctl restart bind9
systemctl status bind9
14. Kemudian uji coba dns server di ubuntu
 nslookup smk-angkasa.sch.id
 
Server:		10.10.22.1
Address:	10.10.22.1#53

Name:	smk-angkasa.sch.id
Address: 10.10.22.1
1. Lakukan update repo
# apk update
2. Install bind-tools
 
apk add bind-tools
3. Cek konfigurasi resolv.conf
 
cat /etc/resolv.conf
4. Tambahkan dns server ubuntu ke resolv.conf
 
echo "nameserver 10.10.22.1" > /etc/resolv.conf
5. Lakukan uji coba
 
nslookup smk-angkasa.sch.id
nslookup web.smk-angkasa.sch.id
dig smk-angkasa.sch.id TXT

Tidak ada komentar:

Posting Komentar