Install DNS Server Debian 12

Dari Dokumentasi Robie
Loncat ke navigasi Loncat ke pencarian

Persiapan sebelum Install

Pastikan server sudah mendapatkan ip address.

Cek dengan cara mengetikan

#ip a (enter)

Jika sudah muncul tampilan berikut, artinya sudah mendpatkan ip address

root@latdns:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0@if114: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 76:69:11:b8:38:cd brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 192.168.20.8/24 <== (ini adalah ip address pc) brd 192.168.20.255 scope global dynamic eth0
       valid_lft 1717sec preferred_lft 1717sec
    inet6 fe80::7469:11ff:feb8:38cd/64 scope link 
       valid_lft forever preferred_lft forever
root@latdns:~# 

Lalu

Cek koneksi internet

dengan mengetikkan perintah

#ping google.com (enter)

Jika muncul tampilan seperti ini artinya sudah ada koneksi internet

root@latdns:~# ping google.com
PING google.com (216.239.38.120) 56(84) bytes of data.
64 bytes from any-in-2678.1e100.net (216.239.38.120): icmp_seq=1 ttl=117 time=32.1 ms
64 bytes from any-in-2678.1e100.net (216.239.38.120): icmp_seq=3 ttl=117 time=31.7 ms
64 bytes from any-in-2678.1e100.net (216.239.38.120): icmp_seq=4 ttl=117 time=31.4 ms
64 bytes from any-in-2678.1e100.net (216.239.38.120): icmp_seq=5 ttl=117 time=31.8 ms
^C <== (untuk menghentikan ping, tekan kombinasi keyboard ctrl + c)
--- google.com ping statistics ---
5 packets transmitted, 4 received, 20% packet loss, time 5056ms
rtt min/avg/max/mdev = 31.413/31.726/32.059/0.232 ms
root@latdns:~# 

Update sistem

dengan mengetikan perintah

#apt update (enter)

Jika berhasil akan muncul tampilan berikut

root@latdns:~# apt update
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]                     
Get:3 http://deb.debian.org/debian bookworm/main amd64 Packages [8788 kB]                   
Get:4 http://security.debian.org bookworm-security InRelease [48.0 kB]                      
Get:5 http://security.debian.org bookworm-security/main amd64 Packages [169 kB]             
Get:6 http://security.debian.org bookworm-security/main Translation-en [102 kB]
Get:7 http://security.debian.org bookworm-security/contrib amd64 Packages [644 B]
Get:8 http://security.debian.org bookworm-security/contrib Translation-en [372 B]
Get:9 http://deb.debian.org/debian bookworm/main Translation-en [6109 kB]                   
Get:10 http://deb.debian.org/debian bookworm/contrib amd64 Packages [54.1 kB]               
Get:11 http://deb.debian.org/debian bookworm/contrib Translation-en [48.8 kB]               
Get:12 http://deb.debian.org/debian bookworm-updates/main amd64 Packages.diff/Index [10.6 kB]
Get:13 http://deb.debian.org/debian bookworm-updates/contrib amd64 Packages.diff/Index [1591 B]
Get:14 http://deb.debian.org/debian bookworm-updates/main amd64 Packages T-2024-04-23-2036.10-F-2023-07-15-1409.27.pdiff [10.6 kB]
Get:14 http://deb.debian.org/debian bookworm-updates/main amd64 Packages T-2024-04-23-2036.10-F-2023-07-15-1409.27.pdiff [10.6 kB]
Get:15 http://deb.debian.org/debian bookworm-updates/contrib amd64 Packages T-2024-02-16-2007.16-F-2024-02-16-2007.16.pdiff [682 B]
Get:15 http://deb.debian.org/debian bookworm-updates/contrib amd64 Packages T-2024-02-16-2007.16-F-2024-02-16-2007.16.pdiff [682 B]
Get:16 http://deb.debian.org/debian bookworm-updates/main Translation-en [16.0 kB]          
Get:17 http://deb.debian.org/debian bookworm-updates/contrib Translation-en [408 B]         
Get:18 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [13.8 kB]          
Fetched 10.0 MB in 3min 5s (54.2 kB/s)                                                      
Reading package lists... Done
Building dependency tree... Done
78 packages can be upgraded. Run 'apt list --upgradable' to see them.
N: Repository 'http://deb.debian.org/debian bookworm InRelease' changed its 'Version' value from '12.0' to '12.6'
root@latdns:~# 

Install aplikasi bind9

#apt install bind9 (enter)

Jika muncul tampilan berikut artinya proses instalasi berhasil

root@latdns:~# apt install bind9
Reading package lists... Done
Building dependency tree... Done
The following additional packages will be installed:
  bind9-dnsutils bind9-host bind9-libs bind9-utils dns-root-data
Suggested packages:
  bind-doc resolvconf ufw
The following NEW packages will be installed:
  bind9 bind9-utils dns-root-data
The following packages will be upgraded:
  bind9-dnsutils bind9-host bind9-libs
3 upgraded, 3 newly installed, 0 to remove and 75 not upgraded.
Need to get 3059 kB of archives.
After this operation, 3077 kB disk space will be freed.
Do you want to continue? [Y/n] Y <== (ketikkan Y, lalu tekan enter)
Get:1 http://deb.debian.org/debian bookworm/main amd64 dns-root-data all 2024041801~deb12u1 [4356 B]
Get:2 http://security.debian.org bookworm-security/main amd64 bind9-host amd64 1:9.18.28-1~deb12u2 [307 kB]
Get:3 http://security.debian.org bookworm-security/main amd64 bind9-dnsutils amd64 1:9.18.28-1~deb12u2 [407 kB]
Get:4 http://security.debian.org bookworm-security/main amd64 bind9-libs amd64 1:9.18.28-1~deb12u2 [1427 kB]
Get:5 http://security.debian.org bookworm-security/main amd64 bind9-utils amd64 1:9.18.28-1~deb12u2 [413 kB]
Get:6 http://security.debian.org bookworm-security/main amd64 bind9 amd64 1:9.18.28-1~deb12u2 [500 kB]
Fetched 3059 kB in 1min 30s (33.9 kB/s)                                                     
Reading changelogs... Done
(Reading database ... 19147 files and directories currently installed.)
Preparing to unpack .../0-bind9-host_1%3a9.18.28-1~deb12u2_amd64.deb ...
Unpacking bind9-host (1:9.18.28-1~deb12u2) over (1:9.18.12-1) ...........................] 
Preparing to unpack .../1-bind9-dnsutils_1%3a9.18.28-1~deb12u2_amd64.deb ................] 
Unpacking bind9-dnsutils (1:9.18.28-1~deb12u2) over (1:9.18.12-1) .......................] 
Preparing to unpack .../2-bind9-libs_1%3a9.18.28-1~deb12u2_amd64.deb ....................] 
Unpacking bind9-libs:amd64 (1:9.18.28-1~deb12u2) over (1:9.18.12-1) .....................] 
Selecting previously unselected package bind9-utils......................................] 
Preparing to unpack .../3-bind9-utils_1%3a9.18.28-1~deb12u2_amd64.deb ...
Unpacking bind9-utils (1:9.18.28-1~deb12u2) .............................................] 
Selecting previously unselected package dns-root-data....................................] 
Preparing to unpack .../4-dns-root-data_2024041801~deb12u1_all.deb ...
Unpacking dns-root-data (2024041801~deb12u1) ............................................] 
Selecting previously unselected package bind9............................................] 
Preparing to unpack .../5-bind9_1%3a9.18.28-1~deb12u2_amd64.deb ...
Unpacking bind9 (1:9.18.28-1~deb12u2) ...########........................................] 
Setting up bind9-libs:amd64 (1:9.18.28-1~deb12u2) .......................................] 
Setting up dns-root-data (2024041801~deb12u1) ...########................................] 
Setting up bind9-utils (1:9.18.28-1~deb12u2) ...###############..........................] 
Setting up bind9 (1:9.18.28-1~deb12u2) ...###########################....................] 
Adding group `bind' (GID 112) ...######################################..................] 
Done.
Adding system user `bind' (UID 103) ...
Adding new user `bind' (UID 103) with group `bind' ...
Not creating home directory `/var/cache/bind'.
wrote key file "/etc/bind/rndc.key"
named-resolvconf.service is a disabled or a static unit, not starting it.
Created symlink /etc/systemd/system/bind9.service -> /lib/systemd/system/named.service.
Created symlink /etc/systemd/system/multi-user.target.wants/named.service -> /lib/systemd/system/named.service.
Setting up bind9-host (1:9.18.28-1~deb12u2) ...###########################...............] 
Setting up bind9-dnsutils (1:9.18.28-1~deb12u2) ...#############################.........] 
Processing triggers for man-db (2.11.2-2) ...#########################################...] 
Processing triggers for libc-bin (2.36-9) ...
root@latdns:~# 

Konfigurasi bind9

Masuk ke folder bind

dengan mengetikkan perintah

#cd /etc/bind/ (enter)

lalu

copy file default named.conf.local menjadi named.conf.old

dengan mengetikkan perintah

#cp named.conf.local named.conf.old (enter)

edit file named.conf.local

dengan mengetikan perintah

#nano named.conf.local (enter)

tambahkan kode berikut pada file diatas

zone "robie.tkj1" {
        type master;
        file "/etc/bind/db.robie";
};

zone "8.20.168.192.in-addr.arpa" {
        type master;
        file "/etc/bind/db.192";
};

Jika sudah selesai, untuk menyimpan gunakan kombinasi tombol keyboard ctrl+x, lalu tekan tombol y, terakhir tekan tombol enter.

Kemudian

copy file db.local menjadi db.robie

dengan mengetikkan perintah

#cp db.local db.robie

edit file db.robie

dengan mengetikkan perintah

#nano db.robie (enter)

Rubah kode berikut

;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     localhost. root.localhost. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.
@       IN      A       127.0.0.1
@       IN      AAAA    ::1

menjadi seperti ini

;
; BIND data file for local loopback interface
;
$TTL    604800

@       IN      SOA     robie.tkj1. root.robie.tkj1. (  

                              2         ; Serial
                         604800         ; Refresh 
                         86400         ; Retry
                       2419200         ; Expire
                         604800 )       ; Negative Cache TTL
 
;
@       IN      NS      robie.tkj1.
@       IN      A       192.168.20.8
www     IN      A       192.168.20.8
mail    IN      A       192.168.20.8
ftp     IN      A       192.168.20.8

Copy file db.255 menjadi db.192

dengan mengetikkan perintah

#cp db.255 db.192 (enter)

lalu

edit file db.192

dengan mengetikkan perintah

#nano db.192 (enter)

Rubah kode berikut

;
; BIND reverse data file for broadcast zone
;
$TTL    604800
@       IN      SOA     localhost. root.localhost. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.

menjadi seperti ini

;
;BIND reverse data file for broadcast zone
;

$TTL    604800
@       IN      SOA     robie.tkj1. root.robie.tkj1. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      robie.tkj1.
l       IN      PTR     robie.tkj1.

Rubah file resolv.conf

dengan mengetikkan perintah

#nano /etc/resolv.conf

rubah file berikut

nameserver 192.168.20.1
nameserver 180.250.245.142
nameserver 180.250.245.133

menjadi

nameserver 192.168.20.9 (sesuaikan dengan ip pc masing-masing)
#nameserver 180.250.245.142 
#nameserver 180.250.245.133

langkah terakhi konfigurasi lakukan

restart aplikasi bind9

dengan mengetikkan perintah

#systemctl restart bind9 (enter)

lalu,

cek status aplikasi bind9

dengan mengetikkan perintah

#systemctl status bind9 (enter)

Jika sudah muncul seperti ini, maka aplikasi bind9 sudah berjalan normal dengan melihat bagian Active: active (running)

* named.service - BIND Domain Name Server

     Loaded: loaded (/lib/systemd/system/named.service; enabled; preset: enabled)
     Active: active (running) since Wed 2024-07-31 00:52:24 UTC; 29min ago
       Docs: man:named(8)
   Main PID: 3473 (named)
     Status: "running"
      Tasks: 5 (limit: 38314)
     Memory: 6.6M
        CPU: 1.003s
     CGroup: /system.slice/named.service
             `-3473 /usr/sbin/named -f -u bind

Pengujian

Buka Setingan Jaringan, dan tambahkan DNS pada bagian berikut sesuai dengan IP yang di dapatkan di mesin virtual proxmox masing-masing:

Nslookup windows.png


masuk ke windows lalu buka cmd, lalu ketikkan

C:\Users\USER>nslookup robie.tkj1

Jika muncul seperti ini artinya domain sudah berhasil berjalan dengan normal

9.20.168.192.in-addr.arpa
        primary name server = robie.tkj1
        responsible mail addr = root.robie.tkj1
        serial  = 1
        refresh = 604800 (7 days)
        retry   = 86400 (1 day)
        expire  = 2419200 (28 days)
        default TTL = 604800 (7 days)
Server:  UnKnown
Address:  192.168.20.9
Name:    robie.tkj1
Address:  192.168.20.9

cek sekali lagi untuk ip addressnya dengan mengetikkan

C:\Users\USER>nslookup 192.168.20.9

Jika muncul seperti ini artinya domain sudah berhasil berjalan dengan normal

C:\Users\USER>nslookup 192.168.20.9
9.20.168.192.in-addr.arpa
        primary name server = robie.tkj1
        responsible mail addr = root.robie.tkj1
        serial  = 1
        refresh = 604800 (7 days)
        retry   = 86400 (1 day)
        expire  = 2419200 (28 days)
        default TTL = 604800 (7 days)
Server:  UnKnown
Address:  192.168.20.9
9.20.168.192.in-addr.arpa
        primary name server = robie.tkj1
        responsible mail addr = root.robie.tkj1
        serial  = 1
        refresh = 604800 (7 days)
        retry   = 86400 (1 day)
        expire  = 2419200 (28 days)
        default TTL = 604800 (7 days)
*** No internal type for both IPv4 and IPv6 Addresses (A+AAAA) records available for 192.168.20.9
C:\Users\USER>