Domain Name System adalah suatu metode untuk meng-konversikan Ip Address (numerik) suatu komputer ke dalam suatu nama domain (alphabetic), ataupun sebaliknya. Yang memudahkan kita dalam mengingat computer tersebut. Misalnya, server Debian memiliki alamat Ip Address sekian, namun pada umumnya, orang tidak akan mudah mengingat alamat Ip dalam bentuk numerik tersebut. Dengan adanya DNS Server, kita bisa mengakses halaman situs dari server Debian tersebut hanya dengan mengakses nama Domain-nya (www.hex-a.net), tanpa mengingat Ip Address dari computer tersebut.
Langkah-langkah konfigurasi DNS Server
1. Setting Ip Address
nano /etc/network/interfaces
Edit seperti script di bawah ini
auto eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254
Untuk menyimpan tekan ctrl+o enter kemudian ctrl+x untuk keluar
Restart Kartu jaringan agar konfigurasi ip bisa berjalan
/etc/init.d/networking restart
2. Mengubah nama hosts
nano /etc/hosts
Edit tulisan yang berwarna merah
127.0.0.1 debian localhost.localdomain localhost
192.168.1.1 admin hex-a.net server
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Untuk menyimpan tekan ctrl+o enter kemudian ctrl+x untuk keluar
3. Menambahkan DNS
nano /etc/resolv.conf
Edit seperti di bawah
# Generated by NetworkManager
search hex-a.net
nameserver 192.168.1.1
Untuk menyimpan tekan ctrl+o enter kemudian ctrl+x untuk keluar
4. Install paket bind9
apt-get install bind9
Bila ada konfirmasi Y/n maka pilih Y kemudian enter
5. Membuat zone untuk domain hex-a.net
nano /etc/bind/named.conf
Tambahkan seperti script yang berwarna merah di bawah ini
// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local
zone "hex-a.net" {
type master ;
file "/var/cache/bind/hexa.ford";
};
zone "1.168.192.in-addr.arpa" {
type master ;
file "/var/cache/bind/hexa.ref";
};
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";
Untuk menyimpan tekan ctrl+o enter kemudian ctrl+x untuk keluar
6. Membuat file fordward
cp /etc/bind/db.local /var/cache/bind/hexa.ford
Edit file hexa.ford
nano /var/cache/bind/hexa.ford
Edit script seperti di bawah ini
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA hex-a.net. root.hex-a.net. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS hex-a.net.
@ IN A 192.168.1.1
www IN A 192.168.1.1
ftp IN A 192.168.1.1
mail IN A 192.168.1.1
eyeos IN A 192.168.1.1
Untuk menyimpan tekan ctrl+o enter kemudian ctrl+x untuk keluar
7. Membuat file reverse
cp /etc/bind/db.127 /var/cache/bind/hexa.ref
Edit file reverse
nano /var/cache/bind/hexa.ref
Edit script seperti di bawah ini
;
; BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN SOA hex-a.net. root.hex-a.net. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS hex-a.net.
1 IN PTR hex-a.net.
1 IN PTR www.hex-a.net.
1 IN PTR ftp.hex-a.net.
1 IN PTR mail.hex-a.net.
1 IN PTR eyeos.hex-a.net.
Untuk menyimpan tekan ctrl+o enter kemudian ctrl+x untuk keluar
8. Restart layanan bind9
/etc/init.d/bind9 restart
Jika berhasil maka akan muncul tampilan seperi dibawah ini
Stopping domain name service...: bind9 waiting for pid 1407 to die.
Starting domain name service...: bind9.
9. Lakukan cek konfigurasi DNS
root@debian:/home/h4cker# named-checkconf -z
10. Lakukan pengujian DNS Server
root@debian:/home/h4cker# nslookup 192.168.1.1
Apabila berhasil maka akan muncul tampilan di bawah ini
Server: 192.168.1.1
Address: 192.168.1.1#53
1.1.168.192.in-addr.arpa name = eyeos.hex-a.net.
1.1.168.192.in-addr.arpa name = hex-a.net.
1.1.168.192.in-addr.arpa name = ftp.hex-a.net.
1.1.168.192.in-addr.arpa name = www.hex-a.net.
1.1.168.192.in-addr.arpa name = mail.hex-a.net.
root@debian:/home/h4cker# nslookup hex-a.net
Apabila berhasil maka akan muncul tampilan di bawah ini
Server: 192.168.1.1
Address: 192.168.1.1#53
Name: hex-a.net
Address: 192.168.1.1
root@debian:/home/h4cker# dig any hex-a.net
root@debian:/home/h4cker# dig -x hex-a.net
Jika tidak ada permasalahan maka konfigurasi DNS Server untuk domain hex-a.net sudah berhasil.