Nubie mencoba Squid (Proxy)

Diskusi tentang Ubuntu Server baik webserver, database server, samba server dan service lainnya serta jaringan menggunakan Sistem Operasi Ubuntu.
User avatar
Furqon
Posts: 6
Joined: 02 Apr 2011, 20:24
Contact:

Nubie mencoba Squid (Proxy)

Postby Furqon » 02 Apr 2011, 22:16

Para mastah2 ubuntu server saya mau tny nih ane punya topologi kek gni

Internet
|
Modem ip lokal 10.x.x.x
|
|eth1 10.x.x.x
Server gateway&Proxy(ubuntu 10.04LTS)
|eth0 172.20.2.1/22 lokal
|
---------switch/hub-----------
komp client 172.20.2.10-20/22 mikrotik wifi 172.20.2.2/22

Sebelumnya saya cri ref di inet cara instal & config squid di ubuntu 10.04 LTS setelah cri sana-sini akhirnya saia coba ngoprek squidnya berikut isi nya:

http_port 3128 transparent
icp_port 3130
prefer_direct off
cache_mem 200 MB
cache_swap_low 98
cache_swap_high 99
max_filedesc 8192
maximum_object_size 1024 MB
minimum_object_size 0 KB
maximum_object_size_in_memory 4 bytes
ipcache_size 4096
ipcache_low 98
ipcache_high 99
fqdncache_size 4096
cache_replacement_policy heap LFUDA
memory_replacement_policy heap GDSF
cache_dir aufs /home/proxy1 9000 32 128
cache_dir aufs /home/proxy2 9000 32 128
cache_dir aufs /home/proxy3 9000 32 128
cache_access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_store_log none
pid_filename /var/run/squid.pid
cache_swap_log /var/log/squid/swap.state
dns_nameservers /etc/resolv.conf
emulate_httpd_log off
hosts_file /etc/hosts
half_closed_clients off
negative_ttl 1 minutes
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 873
acl Safe_ports port 80 # http
acl Safe_ports port 20 21 # ftp
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535
acl Safe_ports port 631 # cups
acl Safe_ports port 10000 # webmin
acl Safe_ports port 901 # SWAT
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 Safe_ports port 873 # rsync
acl Safe_ports port 110 # POP3
acl Safe_ports port 25 # SMTP
acl Safe_ports port 2095 2096 # webmail from cpanel
acl Safe_ports port 2082 2083 # cpanel
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports !SSL_ports
http_access deny CONNECT !SSL_ports !Safe_ports
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i \.(gif|png|jpg|jpeg|ico)$ 10080 90% 43200 override-expire ignore-no-cache ignore-private
refresh_pattern -i \.(iso|avi|wav|mp3|mp4|mpeg|mpg|swf|flv|x-flv)$ 43200 90% 432000 override-expire ignore-nocache
ignore-private
refresh_pattern -i \.(deb|rpm|exe|ram|bin|pdf|ppt|doc|tiff)$ 10080 90% 43200 override-expire ignore-no-cache
ignore-private
refresh_pattern -i \.(zip|gz|arj|lha|lzh|tar|tgz|cab|rar)$ 10080 95% 43200 override-expire ignore-no-cache
ignore-private
refresh_pattern -i \.(html|htm|css|js|php|asp|aspx|cgi) 1440 40% 40320
refresh_pattern . 0 20% 4320
cache_peer 127.0.0.1 parent 8080 0 no-query no-digest no-netdb-exchange default
hierarchy_stoplist cgi-bin ? .js .jsp
acl QUERY urlpath_regex cgi-bin \? .js .jsp
no_cache deny QUERY
snmp_port 3401
acl snmpsquid snmp_community public
snmp_access allow snmpsquid localhost
snmp_access deny all
acl furqon src 172.20.2.1/22
http_access allow furqon
http_access allow localhost
http_access deny all
http_reply_access allow all
icp_access allow furqon
icp_access allow localhost
icp_access deny all
always_direct deny all

cache_mgr muslich.furqon@gmail.com
cachemgr_passwd 123 all
visible_hostname administrator
cache_effective_user proxy
cache_effective_group proxy
coredump_dir /var/spool/squid
shutdown_lifetime 10 seconds
logfile_rotate 14

setelah itu saya masukkan rule iptablesnya
/sbin/iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-ports 3128
/sbin/iptables -t nat -A PREROUTING -i eth0 -p udp --dport 80 -j REDIRECT --to-ports 3128

setelah itu saya coba buka browser kok ERROR THE REQUEST URL COULD NOT BE RETRIVED di bawah sendiri ada tulisan
*Missing or unknown request method
*Mising URL
*Missing HTTP Identifier
*Request Too Large
*Content Length Missing for post or put request
*Ilegal Character in hostname bla..bla..bla

Tp klo saya hapus rulenya lancar jaya tp percuma port 80 ga bs redirect ke 3128

yang saya tanyakan simpel,kesalahan squid saya ada dmn?
:confused:
User avatar
yudiarbi
Posts: 627
Joined: 22 Mar 2011, 09:31
Location: Probolinggo, Jawa Timur
Contact:

Re: Nubie mencoba Squid (Proxy)

Postby yudiarbi » 02 Apr 2011, 23:08

mencoba membantu, mgkn routingnya begini:
/sbin/iptables -t nat -A PREROUTING -i eth1 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128
/sbin/iptables -t nat -A PREROUTING -i eth1 -p udp -m udp --dport 80 -j REDIRECT --to-ports 3128
eth0 diganti eth1 krn eth1 mengarah ke modem.
sebgai tambahan(bisa dipake bisa tidak), cache_mem terlalu besar bos, kasihan memorynya, oya modemnya mode bridge kan?
User avatar
Furqon
Posts: 6
Joined: 02 Apr 2011, 20:24
Contact:

Re: Nubie mencoba Squid (Proxy)

Postby Furqon » 02 Apr 2011, 23:28

Thanks to sodara yudiarbi atas responnya :) mksd sodara coba diganti eth1 ya trus rule yg lama delete? idealnya mem_cachenya di kasih brp klo memory 1G? saya baca di kasih 1/3 dr size memory yg g ke pake.modemnya adsl jd mode PPOE.
User avatar
yudiarbi
Posts: 627
Joined: 22 Mar 2011, 09:31
Location: Probolinggo, Jawa Timur
Contact:

Re: Nubie mencoba Squid (Proxy)

Postby yudiarbi » 03 Apr 2011, 02:37

[quote=Furqon]Thanks to sodara yudiarbi atas responnya :) mksd sodara coba diganti eth1 ya trus rule yg lama delete? idealnya mem_cachenya di kasih brp klo memory 1G? saya baca di kasih 1/3 dr size memory yg g ke pake.modemnya adsl jd mode PPOE.

bnr rule yg sblme didelete aj, krn yg lama meredirect yg dr eth0 padahal eth0nya dr topologi punya bos furqon adalah milik lokal, ksh aj cache nya 8mb aj, biar selebihnya hardisknya yg kerja, jd memorynya bs untuk yg lain, kl saya mode modem biasanya bridge, jd biar server yg manage...