Rabu, 27 Oktober 2010

SETTING DHCP DNS SERVER PADA LINUX DEBIAN 4


SETTING DHCP DAN DNS SERVER dan WEB SERVER


Opsi konfigurasi :
IP Address
1.          ns.smkn2tkl.sch.id                  = 200.100.50.20/28
2.          www.smkn2tkl.sch.id              = 200.100.50.25/28
3.          tkj.smkn2tkl.sch.id                  = 200.100.50.25/28
4.          PC Client                                 = 200.100.50.30/28    

DNS Server
1.          SIstem Operasi                       = OSS (Linux/FreeBSD)
2.          Domain                                   = smkn2tkl.sch.id
3.          Email Admin                           = nama_peserta@sekolah.sch.id      
4.          Sub Domain                            = www.smkn2tkl.sch.id
                            tkj.smkn2tkl.sch.id
 Web Server
1.          Sistem Operasi           = OSS (Linux/FreeBSD)
2.          Port Enable                 = 80
3.          Virtual Host Enable     = Yes
4.          Document Root          =
www.smkn2tkl.sch.id  =/home/nama_peserta/smkn2tkl/index.php
tkj.smkn2tkl.sch.id      =/home/nama_peserta/tkj/index.php

PERSIAPAN
Klik Kanan layar desktop
Klik New Terminal

Konfigurasi IP Addres
Ketikkan:
pico /etc/network/interfaces  
¿ (enter)
pastikan isinya seperti di bawah ini:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
Iface lo inet loopback
auto eth0
iface eth0 inet static
address    200.100.50.20
netmask    255.255.255.240
network    200.100.50.0
broadcast  200.100.50.255

Simpan dan keluar:
Tekan Ctrl+O, Enter, kemudian Ctrl+X

Edit file hosts
Ketikkan:
pico /etc/hosts
¿ (enter)

Pastikan isinya:
127.0.0.1       localhosts
200.100.50.20   smkn2tkl.sch.id server
# the following lines are desirable for IpV6 capable hosts

Simpan dan keluar:
Tekan Ctrl+O, Enter, kemudian Ctrl+X

Edit File Resolv.conf
Ketikkan:
pico /etc/resolv.conf 
¿ (enter)

Pastikan Isinya:
domain ns.smkn2tkl.sch.id.
search smkn2tkl.sch.id
nameserver 200.100.50.20


Simpan dan keluar:
Tekan Ctrl+O, Enter, kemudian Ctrl+X

restart network
ketikkan:
/etc/init.d/networking restart   ¿ (enter)
Hasilnya:
Reconfiguring network interfaces…done.
Mengecek IP Addres
Ketikkan:
Ifconfig  ¿ (enter)
Hasilnya (kurang lebih):
eth0 Link encap:Ethernet Hwaddr 00;0C;F1;A4:8D;45
inet addr:200.100.50.20 Bcast:200.100.50.255 Mask:255.255.255.240
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
Collusions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:252 (252.0 b)
Interrupt:11 Base address:0xdc00 Memory:ff8ff000-ff8ff038

2. Installasi DHCP Server

a). Install DHCP Server :
     apt-get install dhcp3-server   ¿ (enter)
b). Edit file konfigurasi DHCP Server :
pico /etc/dhcp3/dhcpd.conf  ¿ (enter)
Hasilnya kurang lebih:
#
# Sample configuration file for ISC dhcpd for Debian
#
# $Id: dhcpd.conf,v 1.1.1.1 2002/05/21 00:07:44 peloy Exp $
#
# The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages (‘none’, since DHCP v2 didn’t
# have support for DDNS.)
ddns-update-style none;
# option definitions common to all supported networks…
#option domain-name 192.168.2.1;
option domain-name-servers 192.168.13.13, 208.67.222.222, 208.67.220.220;”(untuk memberikan secondary IP DNS)”
default-lease-time 600;
max-lease-time 7200;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.
#subnet 10.152.187.0 netmask 255.255.255.0 {
#}
# This is a very basic subnet declaration.
#subnet 10.254.239.0 netmask 255.255.255.224 {
# range 10.254.239.10 10.254.239.20;
# option routers rtr-19-0-1.beckz.net, rtr-19-0-2.beckz.net;
#}
# This declaration allows BOOTP clients to get dynamic addresses,
# which we don’t really recommend.
#subnet 10.254.239.32 netmask 255.255.255.224 {
# range dynamic-bootp 10.254.239.40 10.254.239.60;
# option broadcast-address 10.254.239.31;
# option routers rtr-239-32-1.example.org;
#}
# A slightly different configuration for an internal subnet.
subnet 200.100.50.0 netmask 255.255.255.240 {
range 200.100.50.100 200.100.50.200;
option domain-name-servers 200.100.50.20;
option domain-name “smkn2tkl.sch.id”;
option routers 200.100.50.20;
option broadcast-address 200.100.50.255;
default-lease-time 600;
max-lease-time 7200;
}

# Hosts which require special configuration options can be listed in
# host statements. If no address is specified, the address will be
# allocated dynamically (if possible), but the host-specific information
# will still come from the host declaration.
#host passacaglia {
# hardware ethernet 0:0:c0:5d:bd:95;
# filename “vmunix.passacaglia”;
# server-name “toccata.fugue.com”;
#}
# Fixed IP addresses can also be specified for hosts. These addresses
# should not also be listed as being available for dynamic assignment.
# Hosts for which fixed IP addresses have been specified can boot using
# BOOTP or DHCP. Hosts for which no fixed address is specified can only
# be booted with DHCP, unless there is an address range on the subnet
# to which a BOOTP client is connected which has the dynamic-bootp flag
# set.
#host fantasia {
# hardware ethernet 08:00:07:26:c0:a5; “(untuk menentukan IP yang di dapat dengan memasukkan MAC address)”
# fixed-address fantasia.fugue.com;
#}
host fantasia {
hardware ethernet 00:1E:68:1E:D4:A5;
fixed-address 192.168.13.2;
}
# You can declare a class of clients and then do address allocation
# based on that. The example below shows a case where all clients
# in a certain class get addresses on the 10.17.224/24 subnet, and all
# other clients get addresses on the 10.0.29/24 subnet.
#class “foo” {
# match if substring (option vendor-class-identifier, 0, 4) = “SUNW”;
#}
#shared-network 224-29 {
# subnet 10.17.224.0 netmask 255.255.255.0 {
# option routers rtr-224.example.org;
# }
# subnet 10.0.29.0 netmask 255.255.255.0 {
# option routers rtr-29.example.org;
# }
# pool {
# allow members of “foo”;
# range 10.17.224.10 10.17.224.250;
# }
# pool {
# deny members of “foo”;
# range 10.0.29.10 10.0.29.230;
# }
#}

Simpan dan keluar:

Restart DHCP server
Ketikkan:
/etc/init.d/dhcp3-server restart

3. Installasi DNS Server

Menginstall Paket DNS
apt-get install bind9
Tambahkan scripts pada file /etc/bind/named.conf untuk membuat zone forward dan zone reverse
pico /etc/bind/named.conf

Ketikkan scripts dibawah ini pada baris terbawah.

zone "smkn2tkl.sch.id" {
type master;
file "db.smk";
};

zone "50.100.200.in-addr.arpa" {
type master;
file "db.ip";
};

Simpan dan keluar:

Mengedit file db.ip
Ketikkan :
pico /etc/bind/db.127 Enter

Pastikan Hasilnya:
$TTL 86400
@ IN SOA ns.smkn2tkl.sch.id. root.smkn2tkl.sch.id. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
@  IN NS ns.smkn2tkl.sch.id.
1 IN PTR ns.smkn2tkl.sch.id.
;
2 IN PTR www.
smkn2tkl.sch.id.
2 IN PTR tkj.smkn2tkl.sch.id.


Simpan dengan nama db.ip dan keluar:

Mengedit file db.local
Ketikkan :
pico /etc/bind/db.local Enter

Pastikan Isinya:
$TTL 86400
@ 1D IN SOA ns.smkn2tkl.sch.id. root.smkn2tkl.sch.id. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
1D IN NS ns.smkn2tkl.sch.id.
ns 1D IN A 200.100.50.20
;
smkn2tkl.sch.id. IN A 200.100.50.20
www IN A 200.100.50.25
tkj.smkn2tkl.sch.id. IN A 200.100.50.25


Simpan dengan  nama file db.smk dan keluar:

Edit File Resolv.conf
Ketikkan:
pico /etc/resolv.conf
Pastikan Isinya:
domain ns.smkn2tkl.sch.id.
search smkn2tkl.sch.id
nameserver 200.100.50.20

Simpan dan keluar:
Menjalankan Server DNS
Ketikkan:
/etc/init.d/bind9 restart
Hasilnya:
[root@smkn2tkl root]# service named restart
Stopping named:
named: already running[root@smkn2tkl root]#

Mengecek keberhasilan pembuatan Server DNS
ØMengecek dengan menggunakan nslookup :
Ketikkan:
nslookup -sil 200.100.50

Hasilnya:
Server: 192.168.1.1
Address: 192.168.1.1#53
1.1.168.192.in-addr.arpa name = smkn2tkl.net.

ØMengecek port 53 apakah sudah terbuka :

Ketikkan:
nmap 192.168.1.1

Hasilnya:
Starting nmap V. 3.00 ( www.insecure.org/nmap/ )
Interesting ports on server.smkn2tkl.net (192.168.1.1):
(The 1597 ports scanned but not shown below are in state: closed)
Port State Service
22/tcp open ssh
53/tcp open domain
111/tcp open sunrpc
6000/tcp open X11

Nmap run completed -- 1 IP address (1 host up) scanned in 3 seconds

ØMelakukan test ping :

Ketikkan:
ping smkn2tkl.net

Jika muncul pesan reply seperti berikut, saya ucapkan selamat karena Anda telah berhasil membuat Server DNS. Unuk menghentikan proses PING tekan Ctrl+C

64 bytes from server.smkn2tkl.net (192.168.1.1): icmp_seq=1 ttl=64 time=0.023 ms
64 bytes from server.smkn2tkl.net (192.168.1.1): icmp_seq=2 ttl=64 time=0.028 ms
64 bytes from server.smkn2tkl.net (192.168.1.1): icmp_seq=3 ttl=64 time=0.028 ms
64 bytes from server.smkn2tkl.net (192.168.1.1): icmp_seq=4 ttl=64 time=0.028 ms

PEMBUATAN DNS SERVER JUGA SUDAH SELESAI “bozzzzzzzz”