Selasa, 22 Februari 2011

Cara membuat dns server

Mo bikin DNS Server sendiri. Tutorial ini dibuat di atas distro Ubuntu Server 8.04. Penggunaan
Ubuntu 8.04 sendiri bukan tanpa alasan. Distro ini adalah salah satu versi LTS yang telah di
maintenance selama 3 tahun. Langsung saja periksa apakah paket BIND9 telah terinstall dengan baik.
Perlu diketahui bahwa paket DNS Server di Ubuntu bisa dipilih ketika pertama kali diinstall. Bisa
diperiksa dengan mengetik :
sudo apt-cache policy bind9
contoh di sistem saya :
aspan@aspan-laptop:~$ sudo apt-cache policy bind9
[sudo] password for aspan:
bind9:
Installed: 1:9.7.0.dfsg.P1-1ubuntu0.1
Candidate: 1:9.7.0.dfsg.P1-1ubuntu0.1
Version table:
*** 1:9.7.0.dfsg.P1-1ubuntu0.1 0
500 http://id.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages
500 http://security.ubuntu.com/ubuntu/ lucid-security/main Packages
100 /var/lib/dpkg/status
1:9.7.0.dfsg.P1-1 0
500 http://id.archive.ubuntu.com/ubuntu/ lucid/main Packages
aspan@aspan-laptop:~$
Lihat baris Installed, berarti bind9 sudah terinstall di sistem saya.
Jika belum terinstall, lakukan install, update dulu ketik :
sudo apt-get update
lalu install ketik :
sudo nano apt-get install bind9
Setelah itu langsung saja disetting, masuk ke direktori bind untuk berkenalan dulu dengan file-file bind,
ketik :
cd /etc/bind/
ketik :
ls
contoh di sistem saya :
aspan@aspan-laptop:~$ cd /etc/bind
aspan@aspan-laptop:/etc/bind$ ls
bind.keys db.255 db.ip named.conf named.conf.options
db.0 db.coba db.local named.conf.default-zones rndc.key
db.127 db.empty db.root named.conf.local zones.rfc1918
aspan@aspan-laptop:/etc/bind$
perhatikan file yang bernama db.local. Copy file tersebut, ketik :
sudo cp db.local db.coba
tercipta sebuah file yang bernama db.coba, langsung saja diedit, ketik :
sudo nano db.coba
isinya kurang lebih seperti ini :
;
; 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
ubah menjadi seperti di bawah ini :
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA ns.aspan.net. root.aspan.net. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
IN NS ns.aspan.net.
IN A 192.168.1.10
ns IN A 192.168.1.10
@ IN AAAA ::1
www IN CNAME ns
ftp IN CNAME ns
smtp IN CNAME ns
fulan IN CNAME ns
chat IN CNAME ns
Penjelasan :
No Asal Perubahan
localhost ns.aspan.net
root.localhost. ns.aspan.net
@ IN NS localhost. IN NS ns.aspan.net.
@ IN A 127.0.0.1 @ IN A 192.168.88.13
(tambahan) ns IN A 192.168.88.13
www IN CNAME ns
ftp IN CNAME ns
smtp IN CNAME ns
fulan IN CNAME ns
chat IN CNAME ns
copy file db.coba menjadi db.ip, ketik :
sudo cp db.coba db.ip
edit, ketik :
sudo nano db.ip
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA ns.aspan.net. root.aspan.net. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.aspan.net.
13 IN PTR ns.aspan.net.
ns IN A 192.168.88.13
@ IN AAAA ::1
Penjelasan :
13 adalah host ID dari ip address DNS Server
kemudian edit file named.conf, ketik :
sudo nano named.conf
isinya kurang lebih seperti ini :
// prime the server with knowledge of the root servers
zone "." {
type hint;
file "/etc/bind/db.root";
};
// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912
zone "aspan.net" {
type master;
file "/etc/bind/db.coba";
};
zone "88.168.192.in-addr.arpa" {
type master;
file "/etc/bind/db.ip";
};
zone "0.in-addr.arpa" {
type master;
file "/etc/bind/db.0";
};
zone "255.in-addr.arpa" {
type master;
file "/etc/bind/db.255";
};
restart service bind9 ketik :
sudo /etc/init.d/bind9 restart
kemudian buat seluruh client menggunakan DNS yang telah kita buat. Jika di sistem Linux IP DNS
Server bisa kita masukan di file /etc/resolv.conf, ketik :
sudo nano /etc/resolv.conf
search aspan.net
nameserver 192.168.88.13
jika menggunakan network manager silakan lihat screenshot :
test domain dengan perintah :
dig -x aspan.net
; <<>> DiG 9.7.0-P1 <<>> -x aspan.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 15242
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;net.aspan.in-addr.arpa. IN PTR
;; AUTHORITY SECTION:
in-addr.arpa. 10800 IN SOA A.ROOT-SERVERS.NET. dns-ops.ARIN.NET.
2011021110 1800 900 691200 10800
;; Query time: 258 msec
;; SERVER: 192.168.1.10#53(192.168.1.10)
;; WHEN: Sat Feb 12 00:15:36 2011
;; MSG SIZE rcvd: 107

Tidak ada komentar:

Posting Komentar