my Blog

Just another WordPress.com weblog

Mikrotik dengan Squid Proxy

I. PERSIAPAN DAN DEFINISI DELAY POOLS
Gambaran Umum Delay Pools:
Delay Pools adalah untuk mengkonfigurasikan squid dengan pengaturan bandwidth berdasarkan kriteria tertentu.

Siapkan PC dengan kemampuan lebih, seperti :
1. P4 @ 2 Ghz cukup
2. harddisk cukup kecil saja sekitar 40 Gb 7200 rpm
2. Memory 512 (semakin besar semakin bagus, cachenya agar tidak “tumpah” ke harddisk)
3. Linux Distro (Ubuntu, Fedora Core, Slackware)
4. Squid-cache bisa download lewat: http://www.squid-cache.org/ downloadlah versi terbaru paling stabil (squid2.6 stable 12,saat diketik tulisan ini)
5. Konfigurasi network yang akan digunakan adalah:
….INET—-SWITCH—-MIKROTIK—CLIENT
…………………..|
…………………..——–SQUIDBOX

II. INSTALASI SQUID
A.DOWNLOAD SQUID
Untuk memudahkan instalasi maka, LinuxBox harus sudah bisa terhubung ke internet untuk mendownload langsung sourcenya dengan perintah:

PS: Menggunakan distro Ubuntu

untuk check directory aktif

Code:
admin@squidbox:~$ pwd/home/admin

untuk download langsung dari web squidcache

Code:
admin@squidbox:~$ wget http://www.squid-cache.org/Versions/v2/2.6/squid-2.6.STABLE12.tar.gz

untuk menginstall package squid

Code:
admin@squidbox:~$ tar -zxvf squid-2.6.STABLE12.tar.gzadmin@squidbox:~$ cd squid-2.6.STABLE12/admin@squidbox:~/squid-2.6.STABLE12$ pwd/home/admin/squid-2.6.STABLE12

B.KONFIGURASI SQUID
sampai sini instalasi squid sudah beres, sekarang memberikan hak akses untuk normal user agar untuk menjalankan squid jika perlu di reboot atau maintenace tidak perlu dari user root.

Code:
admin@squidbox:~/squid-2.6.STABLE12$ sudo useradd -d /usr/local/squid/ -r -s /dev/null squid > /dev/null 2>&1

sekarang kita mengkonfigurasi agar squid kita bisa memanfaatkan delay-pools dan juga mengaktifkan SNMP untuk MRTG dan ICMP

Code:
admin@squidbox:~/squid-2.6.STABLE12$ ./configure –prefix=/home/admin/squid-2.6.STABLE12 \   –exec-prefix=/home/admin/squid-2.6.STABLE12 –enable-gnuregex \   –enable-icmp –enable-snmp \   –enable-delay-pools –enable-cache-diggest \   –enable-removal-policies=heap –enable-default-err-languages=English \   –enable-err-languages=English –enable-async-io=24 \   –with-aufs-threads=24 –with-pthreads \   –with-aio –with-dl \   –enable-storeio=aufs,diskd –enable-epoll \   –enable-kill-parent-hack –disable-ident-lookups \   –disable-wccp –disable-wccpv2 \   –enable-htcp

untuk informasi lebih jelas konfigurasi dan compile squid bisa lihat kesini:
http://wiki.squid-cache.org/SquidFaq/CompilingSquid
http://wiki.squid-cache.org/SquidFaq/ConfiguringSquid

untuk prefix dan exec-prefix disesuaikan dengan directory squidnya.

C.MENGKOMPILE DAN INSTALASI SQUID
setelah konfigurasi awal di atas selesai maka kita bisa mengkompile nya dengan perintah:

Code:
admin@squidbox:~/squid-2.6.STABLE12$ makeadmin@squidbox:~/squid-2.6.STABLE12$ sudo make install

III.Konfigurasi squid.conf
A.Penjelasan Delay Pools dan parameternya
Untuk Penjelasan Mengenai Delay Pools bisa ke thread ini, karena kalau terlalu panjang Tutsnya nanti malah jadi Boring dan Pusing. ^^
http://www.forummikrotik.com/showthr…ted=1#post1608

B. Mengedit Squid.conf
Untuk mengedit konfigurasi squid.conf dapat memberikan perintah sebagai berikut:

Code:
admin@squidbox:~/squid-2.6.STABLE12$ sudo nano /home/admin/squid-2.6.STABLE12/etc/squid.conf

Konfigurasi default dan optimalisasi squid.conf:

Code:
http_port 3128hierarchy_stoplist cgi-bin ?acl QUERY urlpath_regex cgi-bin \?

# LOGFILE PATHNAMES AND CACHE DIRECTORIES# —————————————————————————–cache_dir diskd /home/admin/squid-2.6.STABLE12/var/cache 1000 8 256 # << Sesuaikan dengan kebutuhan andaaccess_log /home/admin/squid-2.6.STABLE12/var/logs/access.log squidcache_log /home/admin/squid-2.6.STABLE12/var/logs/cache.loglog_fqdn offbuffered_logs off

# OPTIONS FOR TUNING THE CACHE# —————————————————————————–refresh_pattern /.gif        4320    50%    43200refresh_pattern /.jpg        4320    50%    43200refresh_pattern /.jpeg          4320    50%     43200refresh_pattern /.png           4320    50%     43200refresh_pattern ^http://www.friendster.com/.*   720     100%    10080refresh_pattern ^http://mail.yahoo.com/.*       720     100%    10080refresh_pattern ^http://*.yahoo.*/.*            720     100%    7200refresh_pattern ^http://*.google.com/.*         720     100%    10080refresh_pattern ^http://www.telkomspeedy.com/.* 720     100%    28800refresh_pattern ^http://*.blogsome.com/.*       720     80%     10080refresh_pattern ^http://*.wordpress.com/.*      720     80%     10080refresh-pattern ^http://detik.com/.*            720     90%     2880refresh_pattern ^ftp:           14400   90%     43200   reload-into-imsrefresh_pattern ^gopher:        1440    0%      1440refresh_pattern .               0       20%     4320    reload-into-ims

quick_abort_min 0 KBquick_abort_max 0 KBquick_abort_pct 95

# ACCESS CONTROLS# —————————————————————————–acl my_network src 192.168.1.0/24acl SSL_ports port 443 563#acl Safe_ports port 280                # http-mgmtacl Safe_ports port 443 563             # https#acl Safe_ports port 488                # gss-http#acl Safe_ports port 591                # filemaker#acl Safe_ports port 777                # multiling httphttp_access allow manager localhost my_networkhttp_access allow my_network

acl download url_regex -i \.mp3acl download url_regex -i \.3gpacl download url_regex -i \.aviacl download url_regex -i \.mpgacl download url_regex -i \.mpegacl download url_regex -i \.wavacl download url_regex -i \.flvacl download url_regex -i \.swf

# DELAY POOL PARAMETERS (all require DELAY_POOLS compilation option)# —————————————————————————–delay_pools 2delay_class 1 3delay_parameters 1 -1/-1 -1/-1 8000/8000delay_access 1 allow my_network downloaddelay_access 1 deny alldelay_class 2 2delay_parameters 2 -1/-1 -1/-1delay_access 2 allow my_networkdelay_access 2 deny all

# ADMINISTRATIVE PARAMETERS# —————————————————————————–cache_effective_user squid

# MISCELLANEOUS# —————————————————————————–logfile_rotate 5reload_into_ims onstore_dir_select_algorithm round-robin

# ADMINISTRATIVE PARAMETERS# —————————————————————————–cache_mgr youremail@host.comvisible_hostname localhost

IV. Menjalankan Squid-cache
A. Membuat swap cache

Code:
[root@squidbox]#/usr/local/squid/sbin/squid -z

B. Mengaktifkan Squid di Foreground task

Code:
ghoz@ghoz-desktop:~/squid-2.6.STABLE12$ home/ghoz/squid-2.6.STABLE12/sbin/squid -SNDghoz@ghoz-desktop:~/squid-2.6.STABLE12$ home/ghoz/squid-2.6.STABLE12/sbin/squid start

C. Monitoring TCP squidBox

Code:
admin@squidbox:~/squid-2.6.STABLE12$ sudo netstat -pln | grep squid

Bila tampilan ada yang persis seperti dibawah ini, berarti squid telah berjalan.

Code:
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN     18047/(squid)     udp        0      0 0.0.0.0:3130            0.0.0.0:*                          18047/(squid)     udp        0      0 0.0.0.0:3401            0.0.0.0:*                          18047/(squid)     udp        0      0 0.0.0.0:4827            0.0.0.0:*                          18047/(squid)     udp        0      0 0.0.0.0:32992           0.0.0.0:*                          18047/(squid)

Untuk pengecekan, maka client dicoba untuk browsing, jika ada data in/out maka proses pembuatan transparant proxy sudah berhasil.

7 September 2007 - Ditulis oleh palzum | Mikrotik | | Belum Ada Tanggapan

Belum ada komentar.

Tinggalkan komentar