Tutorial Squid Proxy Under Linux
Apa yang Anda ketahui tentang Squid? Squid sering diartikan secara pendek sebagai proxy. Lalu apa itu proxy? Squid sebagai proxy dapat dimanfaatkan untuk berbagai kebutuhan, antara lain ....Pertama, komputer yang menjalankan Squid dapat bertindak sebagai gateway (gerbang atau jalur khusus) ke Internet bagi komputer lain dalam jaringan lokal. Kedua, Squid sebagai cache, artinya dapat berfungsi untuk menampung informasi (web) yang pernah diakses sebuah komputer, sehingga mempercepat akses komputer lainnya ke isi web tersebut.
Di Linux Fedora Core 4, Squid sudah di install secara otomatis pada saat setup
port : 3128 8080 3127 (tiga port)
space : 3 G (3072M)
alokasi di : /home/cache/squid
network yang diallowed untuk mengakses proxy : 192.168.0.0/24
configurasi dari root:
1.cd /etc/squid
2.backup configurasi squidnya :
Code:
[root@mixter squid]#cp squid.conf squid.conf.org
[root@mixter squid]#cd
3.buat folder /home/cache/squid setelah itu ownernya digantikan ke user squid
Code:
[root@mixter ~]#mkdir -p /home/cache/squid
[root@mixter ~]#chown -R squid:squid /home/cache/squid
4.buat folder cache_dir
Code:
[root@mixter ~]#mkdir /home/cache/squid/spool
[root@mixter ~]#chown -R squid:squid /home/cache/squid
5.selanjutnya adalah mengconfigurasi squid.conf dan bagian2 yang perlu di edit dari squid.conf adalah
a. edit http_portnya yaitu bagian
menjadi
Code:
http_port 3128 8080 3127
b. edit access.lognya
Code:
# cache_access_log /var/log/squid/access.log
menjadi
Code:
cache_access_log /home/cache/squid/access.log
c. edit cache lognya
Code:
# cache_log /var/log/squid/cache.log
menjadi
Code:
cache_log /home/cache/squid/cache.log
d. edit cache_store_log
Code:
# cache_store_log /var/log/squid/store.log
menjadi
Code:
cache_store_log /home/cache/squid/store.log
e. edit memori yang dialokasikan buat menjalankan squidnya, sesuaikan dengan kemampuan squid servernya
menjadi
f.edit cache dir nya, arahkan sesuai dengan langkah no 5 dan juga space alokasinya yaitu 3072 M
Code:
# cache_dir ufs /var/spool/squid 100 16 256
menjadi
Code:
cache_dir ufs /home/cache/squid/spool 3072 16 256
g.nah sekarang tinggal nambahin network yang mau di allowed untuk access proxy servernya
cari bagian :
Code:
#Recommended minimum configuration:
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443 563
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 563 # https, snews
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
dibawah acl localhost src 127.0.0.1/255.255.255.255, tambahkan network yang akan di allowed
Code:
acl net1 src 192.168.0.0/255.255.255.0
setelah itu supaya net1 tadi bisa mengakses squid maka tambahkan http_access allow
cari baris :
Code:
# And finally deny all other access to this proxy
http_access allow localhost
http_access deny all
diantar http_access allow localhost dan http_access deny all tambahkan :
Code:
http_access allow net1
baris ini bisa ditaruh di atas http_access allow localhost atau dibawah http_access allow localhost yang penting diatas http_access deny all
6.setelah itu simpen. lalu start squid nya
Code:
[root@mixter ~]#/etc/init.d/squid start
7.setelah itu gunakan testing squidnya menggunakan browser sambil di lihat acess log nya
Code:
[root@mixter ~]#tail -f /var/log/squid/access.log
delay pools during the day
#####DELAY POOLS
#This is the most important part for shaping incoming traffic with Squid
#For detailed description see squid.conf file or docs at http://www.squid-cache.org
#We don't want to limit downloads on our local network.
acl magic_words1 url_regex -i 192.168
#We want to limit downloads of these type of files
#Put this all in one line
acl magic_words2 url_regex -i ftp .exe .mp3 .vqf .tar.gz .gz .rpm .zip .rar .avi .mpeg .mpe .mpg .qt
.ram .rm .iso .raw .wav .mov
#We don't block .html, .gif, .jpg and similar files, because they
#generally don't consume much bandwidth
#We want to limit bandwidth during the day, and allow
#full bandwidth during the night
#Caution! with the acl below your downloads are likely to break
#at 23:59. Read the FAQ in this bandwidth if you want to avoid it.
acl day time 09:00-23:59
#We have two different delay_pools
#View Squid documentation to get familiar
#with delay_pools and delay_class.
delay_pools 2
#First delay pool
#We don't want to delay our local traffic.
#There are three pool classes; here we will deal only with the second.
#First delay class (1) of second type (2).
delay_class 1 2
#-1/-1 mean that there are no limits.
delay_parameters 1 -1/-1 -1/-1
#magic_words1: 192.168 we have set before
delay_access 1 allow magic_words1
#Second delay pool.
#we want to delay downloading files mentioned in magic_words2.
#Second delay class (2) of second type (2).
delay_class 2 2
#The numbers here are values in bytes;
#we must remember that Squid doesn't consider start/stop bits
#5000/150000 are values for the whole network
#5000/120000 are values for the single IP
#after downloaded files exceed about 150000 bytes,
#(or even twice or three times as much)
#they will continue to download at about 5000 bytes/s
delay_parameters 2 5000/150000 5000/120000
#We have set day to 09:00-23:59 before.
delay_access 2 allow day
delay_access 2 deny !day
delay_access 2 allow magic_words2
referensi : http://sys-admin.org/en/node/87