Pembuatan DNS server menggunakan BIND9

  • Jika kita ingin membangun sebuah dns server pada Linux maka kita harus pastikan bahwa kita terhubung dengan server. Ketikkan Perintah berikut :

lab-2@lab-2-desktop:~$ sudo su

[sudo] password for lab-2:

root@lab-2-desktop:/home/lab-2# mii-tool

eth1: negotiated 100baseTx-FD flow-control, link ok

eth2: no link

eth3: no link

root@lab-2-desktop:/home/lab-2# ifconfig eth1 192.168.0.111

root@lab-2-desktop:/home/lab-2# ifconfig

eth1 Link encap:Ethernet HWaddr 00:19:d1:18:db:8b

inet addr:192.168.0.111 Bcast:192.168.0.255 Mask:255.255.255.0

inet6 addr: fe80::219:d1ff:fe18:db8b/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:183 errors:0 dropped:0 overruns:0 frame:0

TX packets:87 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:35143 (35.1 KB) TX bytes:14276 (14.2 KB)

eth2 Link encap:Ethernet HWaddr 00:02:44:72:1d:f1

UP BROADCAST MULTICAST MTU:1500 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Interrupt:22 Base address:0×1000

eth3 Link encap:Ethernet HWaddr 00:11:95:c7:0b:cd

UP BROADCAST MULTICAST MTU:1500 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Interrupt:21

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:310 errors:0 dropped:0 overruns:0 frame:0

TX packets:310 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:20416 (20.4 KB) TX bytes:20416 (20.4 KB)

  • Itu berarti kita telah mengatur IP kita dan kita uji koneksi ke server yang memiliki ip 192.168.0.1

root@lab-2-desktop:/home/lab-2# ping 192.168.0.1

PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.

64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.378 ms

64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=0.373 ms

64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=0.379 ms

64 bytes from 192.168.0.1: icmp_seq=4 ttl=64 time=0.367 ms

^Z

[1]+ Stopped ping 192.168.0.1

  • Ketikkan Perintah Update dan install BIND 9 pada pc kita

root@lab-2-desktop:/home/lab-2# sudo apt-get update

root@lab-2-desktop:/home/lab-2# sudo apt-get install bind9

  • Setelah BIND 9 terinstall, maka kita atur konfigurasinya

root@lab-2-desktop:/home/lab-2# sudo nano /etc/bind/named.conf.local

** Setelah itu kita ketikkan perintah berikut pada nano editor

//

// Do any local configuration here

//

// Consider adding the 1918 zones here, if they are not used in your

// organization

//include “/etc/bind/zones.rfc1918″;

zone “example.com” {

type master;

file “/etc/bind/db.example.com”;

};

  • Setelah itu ketikkan syntax berikut

root@lab-2-desktop:/home/lab-2# sudo nano /etc/bind/db.example.com

GNU nano 2.0.7 File: /etc/bind/db.example.com

;

; BIND data file for local loopback interface

;

$TTL 604800

@ IN SOA ns.example.com. root.example.com. (

1 ; Serial

604800 ; Refresh

86400 ; Retry

2419200 ; Expire

604800 ) ; Negative Cache TTL

;

@ IN NS ns.example.com.

@ IN A 192.168.0.111

box IN A 192.168.0.111

  • Jika sudah maka kita buat bagiab reverse-nya, Untuk itu kita ketikkan perintah

root@lab-2-desktop:/home/lab-2# sudo nano /etc/bind/named.conf.local

dan tambahkan perintah berikut dibawah perintah yang sudah ada

zone “111.0.168.192.in-addr.arpa” {

type master;

notify no;

file “/etc/bind/db.192″;

};

  • Kemudian ketikkan perintah

root@lab-2-desktop:/home/lab-2# sudo nano /etc/bind/db.192

GNU nano 2.0.7 File: /etc/bind/db.192

;

; BIND reverse data file for local loopback interface

;

$TTL 604800

@ IN SOA ns.example.com. root.example.com. (

2 ; Serial

604800 ; Refresh

86400 ; Retry

2419200 ; Expire

604800 ) ; Negative Cache TTL

;

@ IN NS ns.

111 IN PTR ns.example.com.

  • Kemudian kita restart BIND 9

root@lab-2-desktop:/home/lab-2# sudo /etc/init.d/bind9 restart

* Stopping domain name service… bind9 [ OK ]

* Starting domain name service… bind9 [ OK ]

  • Uji DNS yang telah ada

root@lab-2-desktop:/home/lab-2# nslookup example.com

Server: 192.168.0.111

Address: 192.168.0.111#53

Name: example.com

Address: 192.168.0.111

root@lab-2-desktop:/home/lab-2# dig -x example.com

; <<>> DiG 9.5.1-P2.1 <<>> -x example.com

;; global options: printcmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 45007

;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:

;com.example.in-addr.arpa. IN PTR

;; Query time: 24 msec

;; SERVER: 192.168.0.111#53(192.168.0.111)

;; WHEN: Tue Jun 1 13:53:19 2010

;; MSG SIZE rcvd: 42

0 komentar:

Posting Komentar