Вы находитесь на странице: 1из 8

SETTING IP ADDRESS

# gedit /etc/network/interfaces
Edit seperti script 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
# The primary network interfaces
allow-hotplug eth0
iface eth0 inet dhcp
# The secondary (LAN) network interface
auto eth1
iface eth1 inet static
address 192.168.100.1
netmask 255.255.255.0
Di save dan exit
Kemudian ketik :
#ifconfig
root@debian:/home/smkn3psp# ifconfig
eth0
Link encap:Ethernet HWaddr 00:e0:4c:73:00:fc
inet addr:192.168.2.100 Bcast:255.255.255.255 Mask:255.255.255.0
inet6 addr: fe80::2e0:4cff:fe73:fc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:126 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1300 (1.2 KiB) TX bytes:17922 (17.5 KiB)
Interrupt:42 Base address:0xe000
eth1

Link encap:Ethernet HWaddr 64:70:02:03:25:9b


inet addr:192.168.100.1 Bcast:192.168.100.255 Mask:255.255.255.0
inet6 addr: fe80::6670:2ff:fe03:259b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:120 errors:0 dropped:0 overruns:0 carrier:120
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:17154 (16.7 KiB)
Interrupt:16 Base address:0xec00

Edit file sysctl.conf pada folder /etc/


#gedit /etc/sysctl.conf
Hapus tanda # untuk mengaktifkan ip forwarding
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
#net.ipv4.conf.default.rp_filter=1
#net.ipv4.conf.all.rp_filter=1
# Uncomment the next line to enable TCP/IP SYN cookies
# See http://lwn.net/Articles/277146/
# Note: This may impact IPv6 TCP sessions too
#net.ipv4.tcp_syncookies=1
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
# Uncomment the next line to enable packet forwarding for IPv6
# Enabling this option disables Stateless Address Autoconfiguration
# based on Router Advertisements for this host
#net.ipv6.conf.all.forwarding=1
Ketik perintah :
#gedit /etc/rc.local
Edit script seperti yang dibuat huruf tebal
!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
exit 0
Kemudian simpan dan reboot
#reboot
Periksa kembali iptables untuk memastikan setelah restart routing tables dan nat masih
berfungsi ( MASQUERADE all -- 0.0.0.0/0
0.0.0.0/0 ) dengan mengetik :

#iptables -t nat -n -L
root@debian:/home/smkn3psp# iptables -t nat -n -L
Chain PREROUTING (policy ACCEPT)
target prot opt source
destination
Chain INPUT (policy ACCEPT)
target prot opt source
destination
Chain OUTPUT (policy ACCEPT)
target prot opt source
destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source
destination
MASQUERADE all -- 0.0.0.0/0
0.0.0.0/0
Saatnya menguji di Client (Windows). Sesuaikan dengan konfigurasi di bawah ini

Selesai untuk setting IP Address dan eth0 dan eth1 sudah saling berhubungan

SETTING DNS SERVER


Install paket dns yang diperlukan
# apt-get install bind9
Mengedit file /etc/bind/named.conf.local
# cd /etc/bind
# gedit named.conf.local
//
// 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 "smkn3psp.sch.id" {
type master;
file "/etc/bind/db.smkn3psp.sch.id";
};
zone "192.in-addr.arpa" {
type master;
file "/etc/bind/db.192";
};
Mengkopi file db.local dan db.127
# cd /etc/bind
# cp db.local db.smnk3psp.sch.id
# cp db.127 db.192
Mengedit file db.smkn3psp.sch.id
# gedit db.smkn3psp.sch.id
;
; BIND data file for local loopback interface
;
$TTL 604800
@
IN
SOA root.smkn3psp.sch.id. admin.smkn3psp.sch.id. (
2
; Serial
604800
; Refresh
86400
; Retry
2419200
; Expire
604800 )
; Negative Cache TTL
;

@
@
@
root
mail
www

IN
IN
IN
IN
IN
IN

NS
A
MX
A
A
CNAME

root.smkn3psp.sch.id.
192.168.2.100
1 mail.smkn3psp.sch.id.
192.168.2.100
192.168.2.100
root

Di save dan exit


Mengedit file db.192
# gedit db.192
;
; BIND data file for local loopback interface
;
$TTL 604800
@
IN
SOA root.smkn3psp.sch.id. admin.smkn3psp.sch.id. (
2
; Serial
604800
; Refresh
86400
; Retry
2419200
; Expire
604800 )
; Negative Cache TTL
;
@
IN
NS
root.smkn3psp.sch.id.
100.2.168
IN
PTR www.smkn3psp.sch.id.
100.2.168
IN
PTR mail.smkn3psp.sch.id.
Di save dan exit
Setting file /etc/resolv.conf
# gedit /etc/resolv.conf
search smkn3psp.sch.id
nameserver 192.168.2.100
Di save dan exit
Restart hasil konfigurasi tersebut
# /etc/init.d/bind9 restart
Cek hasil konfigurasi DNS dengan perintah nslookup
# nslookup smkn3psp.sch.id
Server:
Address:

192.168.2.100
192.168.2.100#53

Name: smkn3psp.sch.id
Address: 192.168.2.100

# nslookup www.smkn3psp.sch.id
Server:
Address:

192.168.2.100
192.168.2.100#53

www.smkn3psp.sch.id

canonical name = root.smkn3psp.sch.id.

Name: root.smkn3psp.sch.id
Address: 192.168.2.100

# nslookup 192.168.2.100
Server:192.168.2.100
Address:
192.168.2.100#53
100.2.168.192.in-addr.arpa
100.2.168.192.in-addr.arpa

name = root.smkn3psp.sch.id.
name = mail.smkn3psp.sch.id.

Apabila tampil seperti diatas berarti anda berhasil membuat sebuah DNS server
Tidak ada titik atau spasi ataupun yang lainnya hasil konfigurasi bisa salah atau gagal

SETTING PROXY SERVER


menginstall paket yang dibutuhkan
#apt-get install squid
#nano /etc/squid/squid.conf
1. Cari bagian http_port 3128 dengan menekan tombol Crtl + W
dan ubah menjadi :
http_port 3128 transparent
2. Cari bagian cache_mgr
dan ubah menjadi :
cache_mgr admin@smkn3psp.sch.id
3. Cari bagian visible_hostname
dan ubah menjadi :
visible_hostname www.smkn3psp.sch.id
4. Cari bagian cache_dir ufs /var hilangkan pagar di depan baris cache menjadi
cache_dir ufs /var/spool/squid 100 16 256
5. Cari bagian #cache_mem 8 MB hilangkan # di depannya kemudian ganti 8 MB menjadi
lebih besar (biasanya 14 dari ram).
cache_mem 64 MB
6. Cari bagian dns_nameservers
dan ubah menjadi :
dns_nameservers 8.8.8.8 8.8.4.4
7. Cari bagian acl CONNECT kemudian tambahkan beberapa acl berikut
#konfigurasi acl
acl jaringanku arc 192.168.2.0/26
acl situs dstdomain /etc/squid/blokir
http_access deny situs
http_access allow jaringanku
Jika sudah simpan file tersebut dengan cara CTRL + X kemudian Y kemudian ENTER.
8. Buat file "/etc/squid/blokir" untuk mendata situs yang akan diblokir
#gedit /etc/squid/blokir
www.google.com
www.yahoo.com
google.com
yahoo.com
9. Kemudian buat cache squid dengan perintah : #squid z dan # /etc/init.d/squid restart

10. Jika sudah,supaya squid menjadi transparent kita perlu membelokkan semua akses dari
client yang menuju port 80 (http) menuju port squid (3128) dengan mengunakan iptables,
perintahnya sebagai berikut:
#iptables -t nat -A PREROUTING -p tcp -i eth1 -s 192.168.100.0/26 --dport 80 -j REDIRECT
--to-port 3128
untuk melihat hasil konfigurasi iptables,gunakan perintah berikut :
iptables -t nat -nL
root@debian:/etc/squid# iptables -t nat -nL
Chain PREROUTING (policy ACCEPT)
target prot opt source
destination
REDIRECT tcp -- 192.168.100.0/26 0.0.0.0/0

tcp dpt:80 redir ports 3128

Chain INPUT (policy ACCEPT)


target prot opt source
destination
Chain OUTPUT (policy ACCEPT)
target prot opt source
destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source
destination
MASQUERADE all -- 0.0.0.0/0
0.0.0.0/0
Agar semua konfigurasi iptables tidak hilang sewaktu router di restart,ketikkan perintah
iptables di atas ke file /etc/rc.local letakkan di atas exit 0
Restart squid dengan perintah :
#squid z
#/etc/init.d/squid restart
Kemudian test webside yang diblokir melalui komputer Client

Вам также может понравиться