Squid merupakan proxy server dan daemon web cache serta memiliki kemampuan untuk men-tune-up web server dengan cache request . Pada dasarnya squid didesain untuk berjalan pada Unix sistem, serta dapat juga berjalan dengan baik pada platform windows dengan menggunakan Cygwin
Pastikan bahwa mesin Proxy anda menggunakan versi STABLE
Mesin Proxy membutuhkan paling tidak :
Mesin Proxy membutuhkan paling tidak :
- 512 MB memori Sdram or above
- Hard-disk IDE 5400 rpm or above, kalau ada duit lebih .. Mmm SCSI is beautiful
- Prosesor Intel P2 / Amd K6-2 or above
Kernel harus ditambahkan opsi-opsi dibawah ini
# /usr/src/sys/i386/conf/UrKernelName
# /usr/src/sys/i386/conf/UrKernelName
Tune up disk ( untuk Q1 dan Q2 )
options SYSVMSG
options MSGMNB=16384 # max % of bytes in a queue
options MSGMNI=42 # number of message queue identifiers
options MSGSEG=2049 # number of message segments per queue
options MSGSSZ=64 # size of a message segment ( 32 bit )
options MSGTQL=2048 # max messages in system
options SYSVMSG
options MSGMNB=16384 # max % of bytes in a queue
options MSGMNI=42 # number of message queue identifiers
options MSGSEG=2049 # number of message segments per queue
options MSGSSZ=64 # size of a message segment ( 32 bit )
options MSGTQL=2048 # max messages in system
Tune up memory
options SHMSEG=64 # max shared mem id’s per process
options SHMMNI=96# max shared mem id’s per system
options SHMMAX=2097152 # max shared memory segment size
options SHMALL=4096 # max amount of shared memory
options MAXDSIZ="(640*1024*1024)" options SHMSEG=64 # max shared mem id’s per process
options SHMMNI=96# max shared mem id’s per system
options SHMMAX=2097152 # max shared memory segment size
options SHMALL=4096 # max amount of shared memory
options DFLDSIZ="(640*1024*1024)"
options MAXSSIZ="(512*1024*1024)"
# pico /etc/rc.conf
gateway_enable=YES
router_enable=YES
ifconfig_xl0="inet IP-Public netmask 255.255.255.xxx"
ifconfig_xl1="inet IP-Private netmask 255.xxx.xxx.xxx"
pf_enable="YES"
pf_rules="/etc/pf.conf"
pf_flags=""
pflog_enable="YES"
pflog_logfile="/var/log/pflog"
pflog_flags=""
( sysctl.conf )gateway_enable=YES
router_enable=YES
ifconfig_xl0="inet IP-Public netmask 255.255.255.xxx"
ifconfig_xl1="inet IP-Private netmask 255.xxx.xxx.xxx"
pf_enable="YES"
pf_rules="/etc/pf.conf"
pf_flags=""
pflog_enable="YES"
pflog_logfile="/var/log/pflog"
pflog_flags=""
kern.maxusers=384
kern.ipc.nmbuf=20480
kern.ipc.nmbclusters=32768
vfs.vmiodirenable=1
kern.ipc.maxsockbuf=2097152
kern.ipc.somaxconn=8192
kern.ipc.maxsockbuf=1048576
kern.ipc.maxsockets=16424
kern.maxfiles=65536
kern.maxfilesperproc=32768
net.inet.ip.forwarding=1
net.inet.tcp.rfc1323=1
net.inet.tcp.delayed_ack=0
net.inet.tcp.sendspace=65535
net.inet.tcp.recvspace=65535
net.inet.udp.recvspace=65535
net.inet.udp.maxdgram=57344
net.local.stream.recvspace=65535
net.local.stream.sendspace=65535
net.inet.icmp.icmplim=300
net.inet.icmp.icmplim_output=0
net.inet.tcp.delayed_ack=0
net.inet.ip.portrange.last=40000
create user squid yg tidak dapat login , biar aman seperti kata Om Henrik Nordstrom
# pw group add squid -g 100
# pw user add squid -u 100 -g squid -s /usr/sbin/nologin -d /UrSquidPrefix ( sebagai contoh saya pakai /supersquid )
# pw group add squid -g 100
# pw user add squid -u 100 -g squid -s /usr/sbin/nologin -d /UrSquidPrefix ( sebagai contoh saya pakai /supersquid )
Tentang berapa banyak sebaiknya jumlah hard disk yg digunakan sebagai
cache swap, anda bisa lihat disini
cache swap, anda bisa lihat disini
Untuk squid sebaiknya OS dipisahkan dengan cache swap, serta khusus
menggunakan hard disk tersendiri, Perbanyaklah jumlah direktori
cache swap per hard disk untuk 1 direktori saja
menggunakan hard disk tersendiri, Perbanyaklah jumlah direktori
cache swap per hard disk untuk 1 direktori saja
Pastikan untuk cache swap sudah mount di /etc/fstab, contoh sbb:
/dev/da2s1d /squid1 ufs rw,noatime 0 0
/dev/da3s1d /squid2 ufs rw ,noatime 0 0
/dev/da2s1d /squid1 ufs rw,noatime 0 0
/dev/da3s1d /squid2 ufs rw ,noatime 0 0
BSD memiliki fitur yang disebut sebagai soft-update yang merupakan bsd alternatif untuk system journal, aktifkan dengan opsi berikut ini :
# umount /squid1 /squid2
# tunefs -n enable /squid1 /squid2
# mount /squid1 /squid2
ubah kepemilikan akses
# chown -R squid:squid /squid1 /squid2
# chown -R squid:squid /supersquid/var/logs
# umount /squid1 /squid2
# tunefs -n enable /squid1 /squid2
# mount /squid1 /squid2
ubah kepemilikan akses
# chown -R squid:squid /squid1 /squid2
# chown -R squid:squid /supersquid/var/logs
Sejak 13 Desember 2007, Squid ver 3.0 sudah masuk dalam fase Production yg artinya sudah stabil untuk dapat digunakan. Fuiih kalau dirunut pengembangannya sejak maret 2003 sampai sekarang ini. Luamaaa sekali euyy , but thank u so much for Squid developer n their crew.
## SALUTE ##
Proxy ini berjalan pada spec mesin sbb:
- 1 GB ddr2 ecc
- Intel Xeon 3.0 Ghz
- 1 unit hd scsi 9 GB untuk OS
- 2 unit hd scsi @18 GB untuk cache swap
Download squid versi 3.0 Stable 1
# cd /usr/local
# wget http://www.squid-cache.org/Versions/v3/3.0/squid-3.0.STABLE1.tar.bz2
# tar –xjf squid-3.0.STABLE1.tar.bz2
# cd squid-3.0.STABLE1
# ./configure –prefix=/supersquid
# cd /usr/local
# wget http://www.squid-cache.org/Versions/v3/3.0/squid-3.0.STABLE1.tar.bz2
# tar –xjf squid-3.0.STABLE1.tar.bz2
# cd squid-3.0.STABLE1
# ./configure –prefix=/supersquid
opsi configure untuk diskd-nya freebsd
–enable-gnuregex \
–enable-async-io=24 \ 16 jika pakai single HD, 24 jika lebih dari 1
–enable-storeio=diskd \ linux idem
–enable-removal-policies=heap \ Penting untuk penggunaan fungsi LFUDA-GDSF
–enable-icmp \
–enable-delay-pools \
–disable-wccp \ Jika memang tidak pakai Cisco
–enable-snmp \
–enable-cache-digests \
–enable-default-err-languages=English \
–enable-err-languages=English \
–disable-ident-lookups \
–disable-hostname-checks \
–enable-underscores
–enable-async-io=24 \ 16 jika pakai single HD, 24 jika lebih dari 1
–enable-storeio=diskd \ linux idem
–enable-removal-policies=heap \ Penting untuk penggunaan fungsi LFUDA-GDSF
–enable-icmp \
–enable-delay-pools \
–disable-wccp \ Jika memang tidak pakai Cisco
–enable-snmp \
–enable-cache-digests \
–enable-default-err-languages=English \
–enable-err-languages=English \
–disable-ident-lookups \
–disable-hostname-checks \
–enable-underscores
--enable-arp-acl \ block client based on mac address
# make && make install
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
acl PURGE method PURGE
http_access allow PURGE localhost
http_access deny PURGE
http_access allow PURGE localhost
http_access deny PURGE
acl porn url_regex -i "/supersquid/etc/xxx.txt"
http_access deny porn
acl CLIENTs src 192.168.100.0/24
http_access allow CLIENTs
acl local-dst dst ( alamat ip terdekat )
acl local-domain dstdomain localhost ( domain2 tempatmu bekerja )
always_direct allow localhost local-dst local-domain
always_direct deny all
http_access deny porn
acl CLIENTs src 192.168.100.0/24
http_access allow CLIENTs
acl local-dst dst ( alamat ip terdekat )
acl local-domain dstdomain localhost ( domain2 tempatmu bekerja )
always_direct allow localhost local-dst local-domain
always_direct deny all
acl nastyfile dstdom_regex -i WIN[.*] BUG[.*] EXE ( cegat virus melissa )
http_access deny nastyfile
http_access deny nastyfile
acl CONNECT method CONNECT
http_access deny all
http_access deny all
http_port 3128 transparent
cache_peer (proxyprovidermu) parent 3128 3130 no query
cache_mem 8 MB
maximum_object_size_in_memory 256 KB
minimum_object_size 0 KB
maximum_object_size 128 MB
memory_replacement_policy heap GDSF
cache_replacement_policy heap LFUDA # maximum_object_size > 4096 KB
cache_dir diskd /squid1 9000 22 256 Q1=72 Q2=88 # cache swap 1
cache_dir diskd /squid2 9000 22 256 Q1=72 Q2=88 # cache swap 2
store_dir_select_algorithm least-load
cache_swap_low 98
cache_swap_high 99
ipcache_size 4096
ipcache_low 98
ipcache_high 99
diskd_program /supersquid/libexec/diskd # HARUS diaktifkan !
dns_nameservers xxx.xxx.xxx.xxx
cache_peer (proxyprovidermu) parent 3128 3130 no query
cache_mem 8 MB
maximum_object_size_in_memory 256 KB
minimum_object_size 0 KB
maximum_object_size 128 MB
memory_replacement_policy heap GDSF
cache_replacement_policy heap LFUDA # maximum_object_size > 4096 KB
cache_dir diskd /squid1 9000 22 256 Q1=72 Q2=88 # cache swap 1
cache_dir diskd /squid2 9000 22 256 Q1=72 Q2=88 # cache swap 2
store_dir_select_algorithm least-load
cache_swap_low 98
cache_swap_high 99
ipcache_size 4096
ipcache_low 98
ipcache_high 99
diskd_program /supersquid/libexec/diskd # HARUS diaktifkan !
dns_nameservers xxx.xxx.xxx.xxx
# pico /supersquid/etc/xxx.txt
playboy.com
penthouse.com
etc .. etc
playboy.com
penthouse.com
etc .. etc
buat cache swap
# /supersquid/sbin/squid -z
# /supersquid/sbin/squid -z
Jalankan squid anda :
# /supersquid/sbin/squid
# /supersquid/sbin/squid
Setting NAT dengan PF
# pico /etc/pf.conf
ext_if="xl0"
int_if="xl1"
ext_if="xl0"
int_if="xl1"
safe_portr="{21,22,25,53,80,110,143,10001,138,139,389,443,3128,1433,1434}"
set optimization aggressive
set optimization aggressive
# normalisasi
scrub in all
scrub in all
# NAT
nat on $ext_if from $int_if:network to any -> ($ext_if)
nat on $ext_if from $int_if:network to any -> ($ext_if)
# Transparent Proxy Redirectnya
rdr on $int_if inet proto tcp from any to any port www -> 127.0.0.1 port 3128
rdr on $int_if inet proto tcp from any to any port www -> 127.0.0.1 port 3128
block all
pass quick on lo0 all
pass in quick on $ext_if all
pass out quick on $ext_if all
pass in quick on $int_if proto {tcp,udp} from any to any port $safe_portr keep state
pass out on $int_if from any to any keep state
pass in quick on $ext_if all
pass out quick on $ext_if all
pass in quick on $int_if proto {tcp,udp} from any to any port $safe_portr keep state
pass out on $int_if from any to any keep state
# Anti spoofing
pass out on $ext_if proto tcp all modulate state flags S/SA
pass out on $ext_if proto {udp,icmp} all keep state
pass out on $ext_if proto tcp all modulate state flags S/SA
pass out on $ext_if proto {udp,icmp} all keep state
# pfctl -sn
nat on xl0 inet from 192.168.100.0/24 to any -> (xl0) round-robin
rdr on xl1 inet proto tcp from any to any port = http -> 127.0.0.1 port 3128
nat on xl0 inet from 192.168.100.0/24 to any -> (xl0) round-robin
rdr on xl1 inet proto tcp from any to any port = http -> 127.0.0.1 port 3128
NAT sudah jalan 
Untuk IP private misal pakai 192.168.100.0/24, maka set xl1 sebagai gateway bisa di coba pakai 192.168.100.1. Jgn lupa juga install dhcp server.
Tips :
- Squid yang baik tidak membutuhkan swap, apabila swap terpakai maka squid akan mengalami penurunan performance
- per 1GB cache swap di hardisk akan memakan 10MB memori fisik, itu belum service-service yang lain
- untuk linux pakai reiserfs
- cache swap toleransi maksimal 70%,misal hard disk anda 18 GB maka alokasikan 12000 maksimal , contoh : cache_dir diskd /squid1 12000 28 256 Q1=72 Q2=88
- Untuk linux pakai metode akses aufs dan ukuran kernel <>
- Jika pakai 2 direktori partisi cache_swap atau lebih, pakailah mekanisme least-load.
- Bukalah sebanyak mungkin port utk akses keluar,echo 1024 32768 > /proc/sys/net/ipv4/ip_local_port_range atau edit di /etc/sysctl.conf = net.ipv4.ip_local_port_range = 1024 32768 ini berlaku untuk linux.
Dipersilahkan mengcopy atau memperbanyak tutorial tanpa seizin penulis dengan tetap mencantumkan nara sumbernya
written by Adianta aka Pashopati
pashopati@yahoo.com
Referensi
1. http://www.squid-cache.org/
2. Forum Ekstrem squid
2. Forum Ekstrem squid
Thanks to :
1. Allah SWT atas karunia ilmu-Nya yg tidak terbatas.
2. Suhu squidindonesia , Pak Dani/Inad .. domo arigato sensei.
3. Masterpop.
4. Fish.
5. Para Squider Mania di forum hebat ini
2. Suhu squid
3. Masterpop.
4. Fish.
5. Para Squider Mania di forum hebat ini
[get this widget]
4 komentar:
makasih banget mas tutornya bener2 sempurna buat aku
pak saya masih awam dengan namanya squid, bisa kasih tahu id YM nya g.. cz saya mo berguru pada bapak.. terima kasih... atau bisa kirim id nya ke email saya id9587@gmail.com
saya sama2 masih awam juga, silahkan ke sini :
pashopati@yahoo.com
Sangat membantu. Oce deh
Post a Comment