Proxy server adalah sebuah server atau program komputer yang berperan sebagai penghubung antara host yang ada di jaringan ke jaringan internet sebagai cache. Proxy server bisa bertindak sebagai gateway atau pintu masuk yang menghubungan komputer kita dengan jaringan luar apa bila di konfigurasi menjadi router. Namun jika topologi proxy di konfigurasi secara terpisah maka hanya bertindak sebagai cache.
Proxy server berfungsi sebagai berikut:
- Berungsi untuk membagi koneksi
- Dapat menyembunyikan identitas (IP)
- Memblokir situs yang tidak diinginkan
- Mengakses situs yang di blokir
- Berfungsi Sebagai firewall dari situs-situs yang berbahaya
- Sebagai media untuk menyimpan sejarah browsing berupa cache
Topologi
Indihome 192.168.1.254----->eth0 192.168.1.1 eth1 192.168.10.1 ----->klient 192.168.10.2
Indihome 192.168.1.254----->eth0 192.168.1.1 eth1 192.168.10.1 ----->klient 192.168.10.2
1. Konfigurasi IP address
# pico /etc/network/interfaces
auto loiface lo inet loopbackauto eth0iface eth0 inet staticaddress 192.168.1.2netmask 255.255.255.0network 192.168.1.0broadcast 192.168.1.255gateway 192.168.1.254dns-nameservers 192.168.1.254auto eth1iface eth1 inet staticaddress 192.168.10.1netmask 255.255.255.0network 192.168.10.0broadcast 192.168.10.255
2. Restart Network
# /etc/init.d/networking restart
3. Menambahkan alamat DNS
# pico /etc/resolv.conf
dns-search namadomain.com
nameserver 8.8.8.8
4. Menambahkan alamat Repository debian 8
# pico /etc/apt/sources.list
deb http://kambing.ui.ac.id/debian/ jessie main contrib non-free
deb http://kambing.ui.ac.id/debian/ jessie-updates main contrib non-free
deb http://kambing.ui.ac.id/debian-security/ jessie/updates main contrib non-free
5. Update debian
# apt-get update
6. Install Squid3
# apt-get install squid3
7. Konfigurasi
# pipco /etc/squid3/squid.conf
# pico /etc/squid3/squid.conf
Cari dengan menekan tombol ctrl + w
# http_port 3128
ganti
http_port 3128 transparent
# cache_mem 8 MB
ganti
cache_mem 64 MB
# cache_mgr webmaster
ganti
cache_mgr test@gmail.com
#cache_dir ufs /var/spool/squid3 100 16 256
ganti
cache_dir ufs /var/spool/squid3 300 32 512
#visible_hostname localhost
ganti
visible_hostname proxy.domain.com
#minimum_object_size 0 KB
ganti
minimum_object_size 0 KB
#maximum_object_size 4096 KB
ganti
maximum_object_size 4096 KB
acl localhost src 127.0.0.1/32
tambah di bawahnya
acl lan src 192.168.100.0/24
http_access allow localhost
tambah di bawahnya
http_access allow lan
lalu simpan
8. Restart Squid3
# /etc/init.d/squid3 restart
9. Membuat rule iptables untuk redirect packet port 80 ke port 3128
# iptables -t nat -A PREROUTING -i eth1 -p tcp –s 192.168.10.0/24 -m tcp --dport 80 -j REDIRECT --to-port 3128 # iptables -t nat -A PREROUTING –i eth1 -p udp –s 192.168.10.0/24 -m udp --dport 80 -j REDIRECT --to-port 3128
Tambahkan juga perintah di atas, pada file pico /etc/rc.local agar konfigurasi iptables tersimpan
# pico /etc/rc.local
#!/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 PREROUTING -i eth1 -p tcp –s 192.168.10.0/24 -m tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A PREROUTING –i eth1 -p udp –s 192.168.10.0/24 -m udp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
exit 0
0 Komentar