Blogger templates

Pages

Selasa, 23 Juli 2013

Setting Proxy Squid pada Ubuntu 12.04

Pastikan PC telah disetting sebagai router, untuk setting PC router Ubuntu 12.04

Asumsi Proxy:
Dua (2) LAN Card :
eth0: IP 192.168.2.101 (terhubung ke Internet dengan NameServer: 192.168.2.1)
eth1: IP 192.168.1.1 (Terhubung ke LAN, IP LAN Client 192.168.1.2-192.168.1.254)

Wajib baca:
$ Menggunakan terminal dalam level USER
# Menggunakan terminal dalam level ROOT
gunakan perintah
$ sudo su
(untuk Ubuntu dan Turunannya), atau
$ su
( untuk Distro yang lain)
Setelah mengubah file konfigurasi, harus disimpan (Ctrl+S)
1. Instalasi
# apt-get install squid
2. FIle konfigurasi squid
# gedit /etc/squid3/squid.conf

3. membuat cache
# mkdir /cache
# chown proxy:proxy /cache
# chown proxy:proxy /etc/squid/squid.conf
4. Konfigurasi
# gedit /etc/squid3/squid.conf
Cari kata berikut (miring) dan hilangkan tanda pagar didepannya shg menjadi
http_port 3128 transparent
cache_effective_user proxy
cache_effective_group proxy
cache_mgr teguh.timbul@yahoo.co.id
cache_dir ufs /cache 1024 16 256
cache_mem 256 MB
4. Setting client
# gedit /etc/squid3/squid.conf
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
acl clientkantor src 192.168.1.0/24
http_access allow clientkantor
5. Block Situs
# gedit /etc/squid3/squid.conf
acl clientkantor src 192.168.1.0/24
acl porn url_regex “/etc/squid3/block/porn.txt”
http_access deny porn
http_access allow clientkantor
# mkdir /etc/squid3/block/
# chmod 777 -R /etc/squid3/block/
$ gedit /etc/squid3/block/porn.txt
( : TAMBAHKAN SITUS YANG DIBLOCK, satu baris satu situs : )
6. Block Keyword
# gedit /etc/squid3/squid.conf
acl clientkantor src 192.168.1.0/24
acl porn url_regex “/etc/squid3/block/porn.txt”
acl badkey url_regex -i  ”/etc/squid3/block/badkey.txt”
http_access deny porn
http_access deny badkey
http_access allow clientkantor
# mkdir /etc/squid3/block/
# chmod 777 -R /etc/squid3/block/
$ gedit /etc/squid3/block/badkey.txt
( : TAMBAHKAN KEYWORD YANG DIBLOCK, satu baris satu keyword : )
7. Reload konfigurasi
# squid3 -k reconfigure
( tidak perlu restart squid)
Untuk restart:
# /etc/init.d/squid3 restart

8. Setting transparent
# iptables -t nat -A PREROUTING -p tcp -s 192.168.1.0/24 –dport 80 -j REDIRECT –to-port 3128
Taruh di rc.local, supaya konfigurasi tidak hilang dengan:
# gedit /etc/rc.local
sudo iptables -t nat -A PREROUTING -p tcp -s 192.168.1.0/24 –dport 80 -j REDIRECT –to-port 3128
exit 0


0 komentar:

Posting Komentar