Install DNS Server Debian 12: Perbedaan antara revisi

Dari Dokumentasi Robie
Loncat ke navigasi Loncat ke pencarian
Tidak ada ringkasan suntingan
Tidak ada ringkasan suntingan
Baris 13: Baris 13:
  2: eth0@if114: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
  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
      link/ether 76:69:11:b8:38:cd brd ff:ff:ff:ff:ff:ff link-netnsid 0
      inet '''<u>192.168.20.9/24</u>''' <== (ini adalah ip address pc) brd 192.168.20.255 scope global dynamic eth0
      inet '''<u>192.168.20.8/24</u>''' <== (ini adalah ip address pc) brd 192.168.20.255 scope global dynamic eth0
         valid_lft 1717sec preferred_lft 1717sec
         valid_lft 1717sec preferred_lft 1717sec
      inet6 fe80::7469:11ff:feb8:38cd/64 scope link  
      inet6 fe80::7469:11ff:feb8:38cd/64 scope link  
Baris 137: Baris 137:
edit file named.conf.local dengan mengetikan perintah
edit file named.conf.local dengan mengetikan perintah
  #nano named.conf.local (enter)
  #nano named.conf.local (enter)
 
tambahkan kode berikut pada file diatas
  zone "robie.tkj1" {
  zone "robie.tkj1" {
         type master;
         type master;
Baris 147: Baris 147:
         file "/etc/bind/db.192";
         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
  #cp db.local db.robie
  #nano db.robie
  #nano db.robie

Revisi per 1 Agustus 2024 03.14

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:~# 

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
#nano db.robie
;
; 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


#cp db.255 db.192
#nano db.192
;
;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.


#nano /etc/resolv.conf
nameserver 192.168.20.1
nameserver 180.250.245.142
nameserver 180.250.245.133


#systemctl restart bind9
#</nowiki>systemctl status bind9
* 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

masuk ke windows lalu buka cmd, lalu ketikkan

C:\Users\USER>nslookup robie.tkj1


8.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.8
Name:    robie.tkj1
Address:  192.168.20.8