DNS kepanjangan dari Domain Name System adalah sebuah sistem penamaan pada jaringan komputer, yang berfungsi memberikan nama pada setiap Host atau Komputer dan domain (daerah) yang ada di jaringan, dengan ini kita dengan mudah mengingat komputer menggunakan nama yang dikenali manusia, tidak seperti IP Address yang merupakan angka dan mungkin sulit diingat.
Sedangkan DNS Server adalah server yang menyediakan layanan DNS, server ini yang menyimpan database nama domain ataupun komputer, dan akan menerjemahkan dari nama domain menjadi IP Address jika ada yang meminta. Beberapa poin penting dari DNS Server :
- DNS dapat memberi nama sebuah domain atau daerah (bisa disebut zone atau zona) yang terdiri dari banyak komputer didalamnya.
- Dari satu nama domain dapat dibuat sub-domain yang bisa digunakan untuk menamai suatu komputer/server (seperti www,web,blog,dll).
- Menggunakan protokol UDP#53 dalam pengiriman pesan DNS nya, jika ukuran pesannya besar bisa saja menggunakan TCP#53.
- Dalam satu database zone/domain terdiri dari beberapa jenis record yang memiliki perannya masing-masing. Record DNS paling umum :
- A atau AAAA berfungsi untuk menerjemahkan Domain/Sub-domain > IP Address.
- PTR kebalikan dari A.
- NS berisi informasi server dns yang memiliki zone tersebut.
- MX untuk mengarahkan ke mail server yang ada didomain ini.
- CNAME alias atau nama lain dari sebuah nama.
Pada Sistem Operasi Linux CentOS 7 aplikasi yang menjalankan service DNS adalah BIND, Berkeley Internet Name Domain, aplikasi yang dapat membangun sebuah DNS server pada hampir semua distro linux termasuk CentOS.
Sekarang kita akan mencoba mengkonfigurasi DNS Server berdasarkan topologi dibawah ini :
Server m1-dz (DNS Server)
[root@m1-dz ~]# yum -y install bind bind-utils
[root@m1-dz ~]# vi /etc/named.confoptions {listen-on port 53 { any; }; #Agar dapat diakses siapapunlisten-on-v6 port 53 { none; }; #IPv6 tidak digunakandirectory "/var/named";dump-file "/var/named/data/cache_dump.db";statistics-file "/var/named/data/named_stats.txt";memstatistics-file "/var/named/data/named_mem_stats.txt";allow-query { any; }; #Siapapun dapat membaca database DNSforwarders {192.168.100.1; #DNS Server untuk ke internet};recursion yes;/////// Dipotong //////////////};/////// Dipotong //////////////zone "." IN {type hint;file "named.ca";};#Buat zone domain network.dz (forward)zone "network.dz" IN {type master;file "/var/named/db.network"; #lokasi file database};zone "server.dz" IN {type master;file "/var/named/db.server";};#zone reverse IP Network dibalikzone "100.168.192.in-addr.arpa" IN {type master;file "/var/named/db.100"; #lokasi file database};zone "101.168.192.in-addr.arpa" IN {type master;file "/var/named/db.101";};include "/etc/named.rfc1912.zones";include "/etc/named.root.key";
[root@m1-dz ~]# named-checkconf -zzone network.dz/IN: loading from master file /var/named/db.network failed: file not foundzone network.dz/IN: not loaded due to errors._default/network.dz/IN: file not foundzone 100.168.192.in-addr.arpa/IN: loading from master file /var/named/db.100 failed: file not foundzone 100.168.192.in-addr.arpa/IN: not loaded due to errors._default/100.168.192.in-addr.arpa/IN: file not foundzone localhost.localdomain/IN: loaded serial 0zone localhost/IN: loaded serial 0zone 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 0zone 1.0.0.127.in-addr.arpa/IN: loaded serial 0zone 0.in-addr.arpa/IN: loaded serial 0
#Salin saja file contoh database yang sudah ada[root@m1-dz named]# cp named.empty db.network[root@m1-dz named]# cp named.empty db.server[root@m1-dz named]# chown named:named db.network #mengatur permission agar dapat dibaca oleh BIND[root@m1-dz named]# chown named:named db.server[root@m1-dz named]# cp named.empty db.100[root@m1-dz named]# cp named.empty db.101[root@m1-dz named]# chown named:named db.100[root@m1-dz named]# chown named:named db.101#edit file zone forward[root@m1-dz named]# vi db.network$TTL 3H@ IN SOA network.dz. root.network.dz. (0 ; serial1D ; refresh1H ; retry1W ; expire3H ) ; minimum@ IN NS m1-dz.network.dz.@ IN A 192.168.100.10 #root domain akan diarahkan ke server inim1-dz IN A 192.168.100.10 #server ininode01 IN A 192.168.100.11 #server node01node02 IN A 192.168.100.12 #server node02www IN CNAME m1-dz.network.dz. #CNAME www dialihkan ke m1-dzadmin IN CNAME m1-dz.network.dz. #phpmyadminwebmail IN CNAME m1-dz.network.dz. #webmailmail IN CNAME node01.network.dz. #mail-serverdb1 IN CNAME node01.network.dz.db2 IN CNAME node02.network.dz.@ IN MX 0 node01.network.dz. #untuk mail server pada domain ini#untuk zone forward server.dz[root@m1-dz named]# vi db.server$TTL 3H@ IN SOA network.dz. root.network.dz. (0 ; serial1D ; refresh1H ; retry1W ; expire3H ) ; minimum@ IN NS m1-dz.network.dz.@ IN A 192.168.101.10m2-dz IN A 192.168.101.10node01 IN A 192.168.101.11www IN CNAME m2-dz.server.dz.admin IN CNAME m2-dz.server.dz.webmail IN CNAME m2-dz.server.dz.mail IN CNAME node01.server.dz.db1 IN CNAME m2-dz.server.dz.db2 IN CNAME node01.server.dz.@ IN MX 0 node01.server.dz.#edit file zone reverse yang merupakan kebalikannya[root@m1-dz named]# vi db.100$TTL 3H@ IN SOA network.dz. root.network.dz. (0 ; serial1D ; refresh1H ; retry1W ; expire3H ) ; minimum@ IN NS m1-dz.network.dz.10 IN PTR network.dz. #Host ID atau oktet terakhir IP Address10 IN PTR m1-dz.network.dz.11 IN PTR node01.network.dz.12 IN PTR node02.network.dz.#untuk 192.168.101.0[root@m1-dz named]# vi db.101$TTL 3H@ IN SOA network.dz. root.network.dz. (0 ; serial1D ; refresh1H ; retry1W ; expire3H ) ; minimum@ IN NS m1-dz.network.dz.10 IN PTR server.dz.10 IN PTR m2-dz.server.dz.11 IN PTR node01.server.dz.
[root@m1-dz named]# named-checkconf -zzone network.dz/IN: loaded serial 0zone server.dz/IN: loaded serial 0zone 100.168.192.in-addr.arpa/IN: loaded serial 0zone 101.168.192.in-addr.arpa/IN: loaded serial 0zone localhost.localdomain/IN: loaded serial 0zone localhost/IN: loaded serial 0zone 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 0zone 1.0.0.127.in-addr.arpa/IN: loaded serial 0zone 0.in-addr.arpa/IN: loaded serial 0
#membuka firewall untuk dns[root@m1-dz named]# firewall-cmd --add-service=dns --permanentsuccess[root@m1-dz named]# firewall-cmd --reloadsuccess#menjalankan service dns[root@m1-dz named]# systemctl start named[root@m1-dz named]# systemctl enable namedCreated symlink from /etc/systemd/system/multi-user.target.wants/named.service to /usr/lib/systemd/system/named.service.
#atur terlebih dahulu dns server yang digunakan[root@m1-dz named]# nmcli c modify eth0 ipv4.dns 192.168.100.10[root@m1-dz named]# nmcli c down eth0; nmcli c up eth0#kemudian testing menggunakan nslookup atau dig[root@m1-dz named]# nslookup node01.network.dzServer: 192.168.100.10Address: 192.168.100.10#53Name: node01.network.dzAddress: 192.168.100.11[root@m1-dz named]# nslookup www.network.dzServer: 192.168.100.10Address: 192.168.100.10#53www.network.dz canonical name = m1-dz.network.dz.Name: m1-dz.network.dzAddress: 192.168.100.10[root@m1-dz named]# nslookup 192.168.100.10Server: 192.168.100.10Address: 192.168.100.10#5310.100.168.192.in-addr.arpa name = network.dz.10.100.168.192.in-addr.arpa name = m1-dz.network.dz.[root@m1-dz named]# dig network.dz mx #MX Record; <<>> DiG 9.9.4-RedHat-9.9.4-61.el7 <<>> network.dz mx;; global options: +cmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24869;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 3;; OPT PSEUDOSECTION:; EDNS: version: 0, flags:; udp: 4096;; QUESTION SECTION:;network.dz. IN MX;; ANSWER SECTION:network.dz. 10800 IN MX 0 node01.network.dz.;; AUTHORITY SECTION:network.dz. 10800 IN NS m1-dz.network.dz.;; ADDITIONAL SECTION:node01.network.dz. 10800 IN A 192.168.100.11m1-dz.network.dz. 10800 IN A 192.168.100.10;; Query time: 12 msec;; SERVER: 192.168.100.10#53(192.168.100.10);; WHEN: Sat Jun 23 14:31:28 WIB 2018;; MSG SIZE rcvd: 114
Server Node01 & Node02
#Server NODE01[root@localhost ~]# hostnamectl set-hostname node01.network.dz[root@localhost ~]# nmcli c modify eth0 ipv4.addresses 192.168.100.11/24[root@localhost ~]# nmcli c modify eth0 ipv4.gateway 192.168.100.1[root@localhost ~]# nmcli c modify eth0 ipv4.dns 192.168.100.10[root@localhost ~]# nmcli c modify eth0 ipv4.method manual[root@localhost ~]# init 6#Server NODE02[root@localhost ~]# hostnamectl set-hostname node02.network.dz[root@localhost ~]# nmcli c modify eth0 ipv4.addresses 192.168.100.12/24[root@localhost ~]# nmcli c modify eth0 ipv4.gateway 192.168.100.1[root@localhost ~]# nmcli c modify eth0 ipv4.dns 192.168.100.10[root@localhost ~]# nmcli c modify eth0 ipv4.method manual[root@localhost ~]# init 6
[root@node01 ~]# ping m1-dz.network.dzPING m1-dz.network.dz (192.168.100.10) 56(84) bytes of data.64 bytes from m1-dz.network.dz (192.168.100.10): icmp_seq=1 ttl=64 time=0.390 ms64 bytes from m1-dz.network.dz (192.168.100.10): icmp_seq=2 ttl=64 time=0.413 ms--- m1-dz.network.dz ping statistics ---2 packets transmitted, 2 received, 0% packet loss, time 1001msrtt min/avg/max/mdev = 0.390/0.401/0.413/0.023 ms[root@node01 ~]# ping www.network.dzPING m1-dz.network.dz (192.168.100.10) 56(84) bytes of data.64 bytes from network.dz (192.168.100.10): icmp_seq=1 ttl=64 time=0.367 ms64 bytes from network.dz (192.168.100.10): icmp_seq=2 ttl=64 time=0.412 ms--- m1-dz.network.dz ping statistics ---2 packets transmitted, 2 received, 0% packet loss, time 1001msrtt min/avg/max/mdev = 0.367/0.389/0.412/0.029 ms[root@node01 ~]# ping db2.network.dzPING node02.network.dz (192.168.100.12) 56(84) bytes of data.64 bytes from node02.network.dz (192.168.100.12): icmp_seq=1 ttl=64 time=0.592 ms64 bytes from node02.network.dz (192.168.100.12): icmp_seq=2 ttl=64 time=0.450 ms--- node02.network.dz ping statistics ---2 packets transmitted, 2 received, 0% packet loss, time 1001msrtt min/avg/max/mdev = 0.450/0.521/0.592/0.071 ms[root@node02 ~]# ping mail.network.dzPING m1-dz.network.dz (192.168.100.10) 56(84) bytes of data.64 bytes from m1-dz.network.dz (192.168.100.10): icmp_seq=1 ttl=64 time=0.406 ms64 bytes from m1-dz.network.dz (192.168.100.10): icmp_seq=2 ttl=64 time=0.502 ms64 bytes from m1-dz.network.dz (192.168.100.10): icmp_seq=3 ttl=64 time=0.521 ms--- m1-dz.network.dz ping statistics ---3 packets transmitted, 3 received, 0% packet loss, time 2003msrtt min/avg/max/mdev = 0.406/0.476/0.521/0.053 ms#Ping domain yang berada di internet (opsional)[root@node02 ~]# ping google.comPING google.com (74.125.24.101) 56(84) bytes of data.64 bytes from 74.125.24.101 (74.125.24.101): icmp_seq=1 ttl=40 time=54.5 ms64 bytes from 74.125.24.101 (74.125.24.101): icmp_seq=2 ttl=40 time=44.0 ms64 bytes from 74.125.24.101 (74.125.24.101): icmp_seq=3 ttl=40 time=47.9 ms64 bytes from 74.125.24.101 (74.125.24.101): icmp_seq=4 ttl=40 time=45.0 ms64 bytes from 74.125.24.101 (74.125.24.101): icmp_seq=5 ttl=40 time=39.1 ms--- google.com ping statistics ---5 packets transmitted, 5 received, 0% packet loss, time 8072msrtt min/avg/max/mdev = 39.146/46.163/54.566/5.081 ms
[root@m1-dz ~]# tail -f /var/log/messages | grep namedJun 23 14:49:39 m1-dz named[1261]: error (no valid RRSIG) resolving 'arpa/DS/IN': 193.0.14.129#53Jun 23 14:49:39 m1-dz named[1261]: error (no valid RRSIG) resolving 'arpa/DS/IN': 192.58.128.30#53Jun 23 14:49:39 m1-dz named[1261]: error (no valid RRSIG) resolving 'arpa/DS/IN': 192.36.148.17#53Jun 23 14:49:39 m1-dz named[1261]: error (no valid RRSIG) resolving 'arpa/DS/IN': 198.97.190.53#53Jun 23 14:49:39 m1-dz named[1261]: error (no valid RRSIG) resolving 'arpa/DS/IN': 202.12.27.33#53Jun 23 14:49:39 m1-dz named[1261]: error (no valid RRSIG) resolving 'arpa/DS/IN': 192.5.5.241#53Jun 23 14:49:39 m1-dz named[1261]: error (no valid RRSIG) resolving 'arpa/DS/IN': 192.228.79.201#53Jun 23 14:49:39 m1-dz named[1261]: error (no valid RRSIG) resolving 'arpa/DS/IN': 192.203.230.10#53Jun 23 14:49:39 m1-dz named[1261]: error (no valid RRSIG) resolving 'arpa/DS/IN': 199.7.91.13#53Jun 23 14:49:39 m1-dz named[1261]: error (no valid RRSIG) resolving 'arpa/DS/IN': 192.33.4.12#53
Intips Gadget