Sunday, April 12, 2009

DNS Server dengan BIND

Instalasi BIND
#apt-get install bind9 dnsutils
Edit file /etc/bind/named.conf
Tambahkan zone domain :
zone "emnaz.org" {
type master;
file "/etc/bind/db.emnaz.org";
};
Zone untuk reverse :
zone "4.168.192.in-addr.arpa" {
type master;
file "/etc/bind/db.4.168.192";
};
Gunakan file /etc/bind/db.empty untuk contoh
# cd /etc/bind/
# cp db.empty db.emnaz.org
Edit file db.emnaz.org
nama domain: emnaz.org, email info ke: admin@emnaz.org.
@       IN      SOA     emnaz.org. admin.emnaz.org. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
86400 ) ; Negative Cache TTL
;
@ IN NS ns1.emnaz.org.
emnaz.org. IN MX 10 mail.emnaz.org.

emnaz.org. IN A 192.168.4.146
mail IN A 192.168.4.146
pc1 IN A 192.168.4.1

www IN CNAME emnaz.org.
Reverse zone
# cp db.empty db.4.168.192
Edit file db.4.168.192
@       IN      SOA     emnaz.org. admin.emnaz.org. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
86400 ) ; Negative Cache TTL
;
IN NS ns1.emnaz.org.

146 IN PTR ns1.emnaz.org.
1 IN PTR pc1.emnaz.org.
Edit /etc/resolv.conf
nameserver 127.0.0.1
Test query
#dig mail.emnaz.org
; <<>> DiG 9.5.1-P1 <<>> mail.emnaz.org
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46362
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;mail.emnaz.org. IN A

;; ANSWER SECTION:
mail.emnaz.org. 86400 IN A 192.168.4.146

;; AUTHORITY SECTION:
emnaz.org. 86400 IN NS ns1.emnaz.org.

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sun Apr 12 14:02:33 2009
;; MSG SIZE rcvd: 66
Reverse zone test
# dig -x 192.168.4.1

; <<>> DiG 9.5.1-P1 <<>> -x 192.168.4.1
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63254
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;1.4.168.192.in-addr.arpa. IN PTR

;; ANSWER SECTION:
1.4.168.192.in-addr.arpa. 86400 IN PTR pc1.emnaz.org.

;; AUTHORITY SECTION:
4.168.192.in-addr.arpa. 86400 IN NS ns1.emnaz.org.

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sun Apr 12 14:04:20 2009
;; MSG SIZE rcvd: 87

Links:
Ubuntu DNS Server

No comments: