Apa DNS itu?DNS dapat disamakan fungsinya dengan buku telepon. Dimana setiap komputer di jaringan Internet memiliki host name (nama komputer) dan Internet Protocol (IP) address. Secara umum, setiap client yang akan mengkoneksikan komputer yang satu ke komputer yang lain, akan menggunakan host name. Lalu komputer anda akan menghubungi DNS server untuk mencek host name yang anda minta tersebut berapa IP address-nya. IP address ini yang digunakan untuk mengkoneksikan komputer anda dengan komputer lainnya
Struktur DNS
Domain Name Space merupakan sebuah hirarki pengelompokan domain berdasarkan nama, yang terbagi menjadi beberapa bagian diantaranya:
Root-Level Domains
Domain ditentukan berdasarkan tingkatan kemampuan yang ada di struktur hirarki yang disebut dengan level. Level paling atas di hirarki disebut dengan root domain. Root domain di ekspresikan berdasarkan periode dimana lambang untuk root domain adalah (“.”).
Top-Level Domains
Pada bagian dibawah ini adalah contoh dari top-level domains:
- com Organisasi Komersial
- edu Institusi pendidikan atau universitas
- org Organisasi non-profit
- net Networks (backbone Internet)
- gov Organisasi pemerintah non militer
- mil Organisasi pemerintah militer
- num No telpon
- arpa Reverse DNS
- xx dua-huruf untuk kode negara (id:Indonesia,sg:singapura,au:australia,dll)
Top-level domains dapat berisi second-level domains dan hosts.
Second-Level Domains
Second-level domains dapat berisi host dan domain lain, yang disebut dengan subdomain. Untuk contoh:
Domain station, station.com terdapat komputer (host) seperti c.station.com dan subdomain cell.station.com. Subdomain c.station.com juga terdapat komputer (host) seperti operator.c.station.com.
Host Names
Domain name yang digunakan dengan host name akan menciptakan fully qualified domain name (FQDN) untuk setiap komputer. Sebagai contoh, jika terdapat c.station.com, dimana c adalah host name dan station.com adalah domain name
Bagaimana DNS itu bekerja?
Fungsi dari DNS adalah menerjemahkan nama komputer ke IP address (memetakan). Client DNS disebut dengan resolvers dan DNS server disebut dengan name servers. Resolvers atau client mengirimkan permintaan ke name server berupa queries. Name server akan memproses dengan cara mencek ke local database DNS, menghubungi name server lainnya atau akan mengirimkan message failure jika ternyata permintaan dari client tidak ditemukan.
Proses tersebut disebut dengan Forward Lookup Query, yaitu permintaan dari client dengan cara memetakan nama komputer (host) ke IP address.
Install DNS Serverroot@server:~# apt-get install bind9
Konfigurasi DNS Serverroot@server:~# cp /etc/bind/named.conf.options /etc/bind/named.conf.options.ori
root@server:~# gedit /etc/bind/named.conf.options
options {
directory "/var/cache/bind";
forwarders {
202.134.1.5;
202.134.0.155;
202.134.0.5;
202.134.2.5;
202.134.1.10;
203.130.208.18;
203.130.206.250;
203.130.196.6;
203.130.196.155;
203.130.196.5;
222.124.204.34;
203.130.208.18;
};
auth-nxdomain no; # conform to RFC1035
listen-on { 127.0.0.1; 192.168.0.1; };
};
root@server:~# cp /etc/bind/named.conf.local /etc/bind/named.conf.local.ori
root@server:~# gedit /etc/bind/named.conf.local
include "/etc/bind/zones.rfc1918";
zone "c.station" {
type master;
file "/etc/bind/cs.c.station";
};
zone "0.168.192.in-addr.arpa" {
type master;
file "/etc/bind/cs.192";
};
include "/etc/bind/rndc.key";
root@server:~# cp /etc/bind/db.local /etc/bind/cs.c.station
root@server:~# cp /etc/bind/db.local /etc/bind/cs.192
root@server:~# gedit /etc/bind/cs.c.station
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA ns.c.station. mail.c.station. (
2010062458 ;Serial
604800 ;Refresh
86400 ;Retry
2419200 ;Expire
604800 ) ;Negative Cache TTL
;
localhost IN A 127.0.0.1
@ IN NS ns.c.station.
ns IN A 192.168.0.1
smtp IN CNAME ns
www IN CNAME ns
cups IN CNAME ns
proxy IN CNAME ns
server IN A 192.168.0.1
operator IN A 192.168.0.11
direktor IN A 192.168.0.211
client01 IN A 192.168.0.101
client02 IN A 192.168.0.102
client03 IN A 192.168.0.103
client04 IN A 192.168.0.104
client05 IN A 192.168.0.105
client06 IN A 192.168.0.106
client07 IN A 192.168.0.107
client08 IN A 192.168.0.108
client09 IN A 192.168.0.109
client10 IN A 192.168.0.110
client11 IN A 192.168.0.111
client12 IN A 192.168.0.112
client13 IN A 192.168.0.113
client14 IN A 192.168.0.114
client15 IN A 192.168.0.115
client16 IN A 192.168.0.116
client17 IN A 192.168.0.117
client18 IN A 192.168.0.118
client19 IN A 192.168.0.119
client20 IN A 192.168.0.120
client21 IN A 192.168.0.121
root@server:~# gedit /etc/bind/cs.192
;
; BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN SOA ns.c.station. mail.c.station. (
2010062459 ;Serial
604800 ;Refresh
86400 ;Retry
2419200 ;Expire
604800 ) ;Negative Cache TTL
;
@ IN NS ns.
www IN CNAME ns
smtp IN CNAME ns
cups IN CNAME ns
proxy IN CNAME ns
1 IN PTR ns.c.station
11 IN PTR operator.c.station
211 IN PTR direktor.c.station
101 IN PTR client01.c.station
102 IN PTR client02.c.station
103 IN PTR client03.c.station
104 IN PTR client04.c.station
105 IN PTR client05.c.station
106 IN PTR client06.c.station
107 IN PTR client07.c.station
108 IN PTR client08.c.station
109 IN PTR client09.c.station
110 IN PTR client10.c.station
111 IN PTR client11.c.station
112 IN PTR client12.c.station
113 IN PTR client13.c.station
114 IN PTR client14.c.station
115 IN PTR client15.c.station
116 IN PTR client16.c.station
117 IN PTR client17.c.station
118 IN PTR client18.c.station
119 IN PTR client19.c.station
120 IN PTR client20.c.station
121 IN PTR client21.c.station
root@server:~# gedit /etc/hosts
127.0.0.1 localhost localhost.c.station
192.168.0.1 c.station c.station smtp.c.station proxy.c.station
192.168.0.11 operator operator.c.station
192.168.0.211 direktor direktor.c.station
192.168.0.101 client01 client01.c.station
192.168.0.102 client02 client02.c.station
192.168.0.103 client03 client03.c.station
192.168.0.104 client04 client04.c.station
192.168.0.105 client05 client05.c.station
192.168.0.106 client06 client06.c.station
192.168.0.107 client07 client07.c.station
192.168.0.108 client08 client08.c.station
192.168.0.109 client09 client09.c.station
192.168.0.110 client10 client10.c.station
192.168.0.111 client11 client11.c.station
192.168.0.112 client12 client12.c.station
192.168.0.113 client13 client13.c.station
192.168.0.114 client14 client14.c.station
192.168.0.115 client15 client15.c.station
192.168.0.116 client16 client16.c.station
192.168.0.117 client17 client17.c.station
192.168.0.118 client18 client18.c.station
192.168.0.119 client19 client19.c.station
192.168.0.120 client20 client20.c.station
192.168.0.121 client21 client21.c.station
Konfigurasi Name Serverroot@server:~# gedit /etc/resolv.conf
search c.station
nameserver 192.168.0.1
nameserver 127.0.0.1
Restart DNS Serverroot@server:~# /etc/init.d/bind9 restart
* Stopping domain name service... bind9 [ OK ]
* Starting domain name service... bind9 [ OK ]
Checking Konfigurasi DNS Serverroot@server:~# named-checkzone c.station /etc/bind/cs.c.station
zone c.station/IN: loaded serial 2010062458
OK
root@server:~# named-checkzone c.station /etc/bind/cs.192
zone c.station/IN: loaded serial 2010062459
OK
root@server:~# dig localhost
; <<>> DiG 9.7.0-P1 <<>> localhost
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18220
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;localhost. IN A
;; ANSWER SECTION:
localhost. 604800 IN A 127.0.0.1
;; AUTHORITY SECTION:
localhost. 604800 IN NS localhost.
;; ADDITIONAL SECTION:
localhost. 604800 IN AAAA ::1
;; Query time: 22 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Fri Jun 25 02:00:07 2010
;; MSG SIZE rcvd: 85
root@server:~# dig google.com
; <<>> DiG 9.7.0-P1 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4745
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 143 IN A 64.233.181.104
;; AUTHORITY SECTION:
google.com. 1420 IN NS ns1.google.com.
google.com. 1420 IN NS ns2.google.com.
google.com. 1420 IN NS ns4.google.com.
google.com. 1420 IN NS ns3.google.com.
;; ADDITIONAL SECTION:
ns1.google.com. 6884 IN A 216.239.32.10
ns2.google.com. 7135 IN A 216.239.34.10
ns3.google.com. 334 IN A 216.239.36.10
ns4.google.com. 563 IN A 216.239.38.10
;; Query time: 33 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Fri Jun 25 02:01:55 2010
;; MSG SIZE rcvd: 180
root@server:~# nslookup
> set type=any
> c.station
Server: 192.168.0.1
Address: 192.168.0.1#53
c.station nameserver = ns.c.station.
c.station
origin = ns.c.station
mail addr = mail.c.station
serial = 2010062458
refresh = 604800
retry = 86400
expire = 2419200
minimum = 604800
> localhost
Server: 192.168.0.1
Address: 192.168.0.1#53
Name: localhost.c.station
Address: 127.0.0.1
> exit