Ini hanya tutorial sederhana tentang menggunakan DNS Bind di Centos 5.4. Langsung aja yak!

1. Install paket yg dibutuhkan :

# yum install bind bind-­chroot bind­-libs bind­-utils caching­-nameserver

2. Buat file rndc.conf :

# rndc-confgen -b 256 > /var/named/chroot/etc/rndc.conf

3. Lalu buat link ke direktori /etc :

# ln ­s /var/named/chroot/etc/rndc.conf /etc/

4. Setelah itu atur hak akses dan kepemilikan :

# chown root:named /var/named/chroot/etc/rndc.conf
# chmod 640 /var/named/chroot/etc/rndc.conf

5. Kalau sudah, lalu kita buat konfigurasinya dengan nama named : baca name-di (bukan mamed :p )di /var/named/chroot/etc/named.conf

//bagian ini hasil copy­paste dari berkas rndc.conf
key “rndckey” {
algorithm hmac-md5;
secret “dgkwELjKFonV/yxHiSG5Gw==”;
};

controls {
inet 127.0.0.1 allow { 127.0.0.1; } keys{ “rndckey”; };
inet 192.168.5.110 allow { 192.168.5.0/24; } keys{ “rndckey”; };
};

options {
directory “/var/named”;
pid-file “/var/run/named/named.pid”;

recursion yes;

allow-recursion {
127.0.0.1;
192.168.5.0/24;
};

// these are the opendns servers (optional)
#forwarders {
#208.67.222.222;
#208.67.220.220;
#};

listen-on {
127.0.0.1;
192.168.5.110;
};

/*
* If your nameservers is behind firewall you might need to uncomment the query-source
* directive below.
*/
query-source address * port 53;

// for security people can’t try to guess what version you’re running
version “REFUSED”;

allow-query {
127.0.0.1;
192.168.5.0/24;
};
};

server 192.168.5.110 {
keys { rndckey; };
};

zone “.” IN {
type hint;
file “named.ca”;
};

zone “alfach.org” {
type master;
file “data/alfach.zone”;
allow-update { none; };

};

Kalau sudah simpan.

6. Atur lagi hak akses dan kepemilikan filenya :

# chown root:named /var/named/chroot/etc/named.conf
# chmod 640 /var/named/chroot/etc/named.conf

7. Sekarang kita buat zone nya, tempatnya filenya sesuai dengan isi named.conf menunjuk (data/alfach.zone) :

# cd /var/named/chroot/var/named
# vi data/alfach.zone

Ini isi file zone tersebut

$TTL 38400 ; 1 day

@ IN SOA ns.alfach.org admin.alfach.org. (
2008090335 ; Serial
10800 ; Refresh after 3 hours
3600 ; Retry after 1 hour
604800 ; Expire after 1 week
86400 ; Minimum TTL 1 day
)

alfach.org. IN NS ns.alfach.org.
IN A 192.168.5.110
alfach.org. IN MX 1 mx.alfach.org.
ns.alfach.org. IN A 192.168.5.110
mx.alfach.org. IN A 192.168.5.110
mail.alfach.org. IN CNAME mx.alfach.org.

Beberapa catatan diatas, setiap nama domain, selalu diakhiri tanda titik (.)

Tulisan Lain   Setting Waktu dan Tanggal Melalui Command Line di Linux

8. Atur lagi hak akses dan kepemilikian kalau berubah :

# chown root:named /var/named/chroot/var/named/data/alfach.zone
# chmod 640 /var/named/chroot/var/named/data/alfach.zone

9. Jalankan named nya :

# /etc/init.d/named start

10. Kalau mau ditest, edit /etc/resolv.conf

search alfach.org
nameserver 192.168.5.110

test dig
# dig alfach.org

; < <>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5 < <>> alfach.org
;; global options: printcmd
;; Got answer:
;; ->>HEADER< <- opcode: QUERY, status: NOERROR, id: 60548 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 ;; QUESTION SECTION: ;alfach.org. IN A ;; ANSWER SECTION: alfach.org. 38400 IN A 192.168.5.110 ;; AUTHORITY SECTION: alfach.org. 38400 IN NS ns.alfach.org. ;; ADDITIONAL SECTION: ns.alfach.org. 38400 IN A 192.168.5.110 ;; Query time: 69 msec ;; SERVER: 192.168.5.110#53(192.168.5.110) ;; WHEN: Mon Nov 30 13:06:48 2009 ;; MSG SIZE rcvd: 77

test host
# host alfach.org

alfach.org has address 192.168.5.110
alfach.org mail is handled by 1 mx.alfach.org.

test nslookup
# nslookup alfach.org

Server: 192.168.5.110
Address: 192.168.5.110#53

Name: alfach.org
Address: 192.168.5.110

done 🙂

By alfach

Leave a Reply

Your email address will not be published. Required fields are marked *