Membuat DNS Server Lokal
akhirnya jalan juga DNS lokal nya..seharian nyari di mbah ga nemu, akhirnya kilik2 dikit jadi dah..lg pake freeBSD, tapi konfigurasinya bisa koq di linux lainnya, cuma beda tempat aja..
konfigurasi networknya :
Inet ---- Firewall ------ DNS Server ----- DNS Lokal ------- Client
langsung aja biar nda lupa, selagi masih inget..
konfigurasi IP gw :
localhost# ifconfig
em0: flags=8843 mtu 1500
options=b
inet 192.168.1.253 netmask 0xffffff00 broadcast 192.168.1.255
ether 00:04:23:b3:8a:94
media: Ethernet autoselect (1000baseTX)
status: active
xl0: flags=8843 mtu 1500
options=8
inet 172.16.1.6 netmask 0xffffffe0 broadcast 172.16.1.31
ether 00:60:08:3e:bb:61
media: Ethernet autoselect (100baseTX)
status: active
em0: flags=8843
options=b
inet 192.168.1.253 netmask 0xffffff00 broadcast 192.168.1.255
ether 00:04:23:b3:8a:94
media: Ethernet autoselect (1000baseTX
status: active
xl0: flags=8843
options=8
inet 172.16.1.6 netmask 0xffffffe0 broadcast 172.16.1.31
ether 00:60:08:3e:bb:61
media: Ethernet autoselect (100baseTX
status: active
yang mau di jadiin DNS lokal adalah IP 172.16.1.6
login dulu menggunakan root
localhost$ su -
password :
localhost# nano /etc/rc.conf
named_enable="YES" <<---tambahkan ini agar service dns servernya berjalan setiap restart
edit di /etc/resolv.conf ditambahi nameserver (iplocal yang mo di jadiin dns )
localhost# nano /etc/resolv.conf
domain testing.com nameserver 172.16.1.6 di /etc/host.conf ~ dibalik jadi 1.dns 2.hosts jgn lupa backup dulu yak..
localhost# nano /etc/host.conf
#hosts <<---remark aja lah
dns
hosts
konfigurasi named.conf tambahkan zona baru
# cd /etc/namedb/
# cp named.conf named.conf.old
# vi named.conf
/etc/namedb/named.conf
options {
directory "/etc/namedb";
pid-file
"/var/run/named/pid";
dump-file "/var/dump/named_dump.db";
statistics-file "/var/stats/named.stats";
// listen-on { 127.0.0.1; };
// listen-on-v6 { ::1; };
/*
forwarders {
127.0.0.1;
};
*/
};
zone "." {
type hint;
file "named.root";
};
zone "0.0.127.IN-ADDR.ARPA" {
type master;
file "master/localhost.rev";
};
// RFC 3152
zone
"1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6
.ARPA"
{
type master;
file "master/localhost-v6.rev";
};
// RFC 1886 -- deprecated
zone
"1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6
.INT" {
type master;
file "master/localhost-v6.rev";
};
zone "testing.com" {
type master;
file "master/testing.zone";
};
zone "16.172.in-addr.arpa" {
type master;
file "master/testing.rev";
};
bangkitkan file localhost.rev dengan menjalankan make-localhost. Kemudian buat file
eone.rev
# sh make-localhost
# cd master
# cp localhost.rev testing.rev
# vi testing.rev
edit testing.rev , Serial disesuaikan saja dengan ditambahkan waktu setempat cth : 20110916 tambahkan menjadi 2011091621 <<-- 21 jam 9 malem nih...
/etc/namedb/master/testing.rev
$TTL 3600
@ IN SOA testing.com. root.testing.com (
2011091621 ; Serial
3600 ; Refresh
900 ; Retry
3600000 ; Expire
3600 ) ; Minimum
IN NS testing.com
16.1 IN PTR ns3.
100.1 IN PTR oprek.testing.com
101.1 IN PTR setan.testing.com
Buat file testing.zone
# cp testing.rev testing.zone
# vi testing.zone
/etc/namedb/master/testing.zone
$TTL 3600
@ IN SOA testing.com. root.testing.com. (
2011091621 ; Serial
3600 ; Refresh
900 ; Retry
3600000 ; Expire
3600 ) ; Minimum
IN NS ns3.testing.com.
ns3 IN A 172.16.1.6
testing IN CNAME ns3
; Lokal Server Lainnya
oprek IN A 192.168.1.100 <<-- nama server lainnya
setan IN A 192.168.1.101 <<--nama server lainnya
bangkitkan rndc.conf
# rndc-confgen > rndc.conf
/etc/namedb/rndc.conf
key "rndc-key" {
algorithm hmac-md5;
secret "l2wc2DlvXJk/ZtB0N1P3wg==";
};
options {
default-key "rndc-key";
default-server 127.0.0.1;
default-port 953;
};
# End of rndc.conf
# Use with the following in named.conf, adjusting the allow list as
needed:
# key "rndc-key" {
# algorithm hmac-md5;
# secret "l2wc2DlvXJk/ZtB0N1P3wg==";
# };
#
# controls {
# inet 127.0.0.1 port 953
#
allow { 127.0.0.1; } keys { "rndc-key"; };
# };
# End of named.conf
dalam rndc.conf terdapat konfigurasi untuk file named.conf yang tidak diaktifkan (#
comment) tambahkan pada named.conf
# cat rndc.conf >> named.conf
# vi named.conf
/etc/namedb/named.conf
options {
directory "/etc/namedb";
pid-file
"/var/run/named/pid";
dump-file "/var/dump/named_dump.db";
statistics-file "/var/stats/named.stats";
// listen-on { 127.0.0.1; };
// listen-on-v6 { ::1; };
/*
forwarders {
127.0.0.1;
};
*/
};
zone "." {
type hint;
file "named.root";
};
zone "0.0.127.IN-ADDR.ARPA" {
type master;
file "master/localhost.rev";
};
// RFC 3152
zone
"1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6
.ARPA" {
type master;
file "master/localhost-v6.rev";
};
// RFC 1886 -- deprecated
zone
"1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6
.INT" {
type master;
file "master/localhost-v6.rev";
};
zone "eone.org" {
type master;
file "master/testing.zone";
};
zone "16.172.in-addr.arpa" {
type master;
file "master/testing.rev";
};
key "rndc-key" {
algorithm hmac-md5;
secret "l2wc2DlvXJk/ZtB0N1P3wg==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
# End of named.conf
konfigurasi selesai saatnya menjalankan DNS
# /etc/rc.d/named start
Starting named OK
Ujicoba, jika output sama dengan dibawah ini maka DNS berhasil.
# nslookup
> ns
Server:
172.16.1.6
Address:
172.16.1.6#53
Name: ns3.testing.com
Address: 172.16.1.6
> 172.16.1.6
Server:
172.16.1.6
Address:
172.16.1.6#536.1.16.172.in-addr.arpa name = ns3.
atau coba dengan dig
localhost# dig setan.testing.com
; <<>> DiG 9.3.4 <<>> setan.testing.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38351
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;setan.testing.com. IN A
;; ANSWER SECTION:
setan.testing.com. 3600 IN A 192.168.1.101
;; AUTHORITY SECTION:
testing.com. 3600 IN NS ns3.testing.com.
;; ADDITIONAL SECTION:
ns3.testing.com. 3600 IN A 172.16.1.6
;; Query time: 0 msec
;; SERVER: 172.16.1.6#53(172.16.1.6)
;; WHEN: Tue Sep 27 17:16:55 2011
;; MSG SIZE rcvd: 91
segitu aja...terima kasih untuk mbah google,
walau nemunya banyak yg ngasal trus kebanyakan kopas..yg penting dah jalan..hehehe..
InsyaAllah klo ada yg mo nanya bila inget akan di jawab yach...
Thanks