leonardo.dss
(usa Debian)
Enviado em 06/11/2015 - 09:17h
Olá amigos do VOL,
Venho até vocês para pedir que me ajudem com meu problema, já li muita coisa mais nada de efetivo até agora.
Tenho um Servidor Dell Power Edge 2950, Intel(R) Xeon(R) CPU E5310@1.60GHz, 4GB de RAM, 4 HD's 300GB (Raid5 + Hotswap) exclusivo para serviço do Squid/Proxy. Estou usando a versão Squid 3.1.19 no Ubuntu Server 12.04.05 LTS com duas placas de rede (Eth0 = Rede local com ip fixo e Eth1 = Internet da GVT recebendo dhcp).
Meu problema é uma lentidão absurda quando passo pelo Squid, fazendo os testes, liguei um PC direto no Modem da GVT (link de 50 MB) e realizo teste de velocidade da sempre > 45 MB, mas se passo pelo Proxy e faço o teste de velocidade não passa de 5 MB.
Já desabilitei IPV6, cache do Squid, coloquei dns manualmente no resolv.conf e no squid.conf mas o problema continua. Vou postar minhas configurações do Squid.conf, interfaces e iptables.
###### Configuração de rede ###################
auto lo eth0 eth1
iface lo inet loopback
# Rede Local
iface eth0 inet static
address 192.168.1.222
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
# Rede Internet
iface eth1 inet dhcp
-------------------------------------------------------------------------
###### Configuração do Squid ##################
# Configurações Minimas
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl webserver src 192.168.1.222/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 88 # Convenio Agros
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
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
http_access allow manager localhost
http_access allow manager webserver
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
# Liberado
# Intranet
acl intranet url_regex -i "/etc/squid3/acls/intranet"
http_access allow intranet
# Atualizaçoes do Kaspersky
acl kaspersky dstdomain geo.kaspersky.com
http_access allow kaspersky
reply_body_max_size 200 MB kaspersky
refresh_pattern -i geo.kaspersky.com/.*\.(cab|exe|ms[i|u|f]|[ap]sf|wm[v|a]|dat|idx|gz|zip) 14400 80% 43200 reload-into-ims
refresh_pattern -i kaspersky.*\.(cab|exe|ms[i|u|f]|[ap]sf|wm[v|a]|dat|zip|idx|gz|avc) 14400 80% 43200 reload-into-ims
# Atualizações do Windows Update
acl windowsupdate dstdomain "/etc/squid3/acls/windowsupdate"
range_offset_limit -1 windowsupdate
quick_abort_min -1 KB windowsupdate
maximum_object_size 5 GB windowsupdate
refresh_pattern -i c2r.microsoft.com/.*\.(cab|exe|ms[i|u|f]|[ap]sf|wm[v|a]|dat|zip|dsft|psf) 4320 80% 43200 reload-into-ims
refresh_pattern -i download.windowsupdate.com/.*\.(cab|exe|ms[i|u|f]|[ap]sf|wm[v|a]|dat|zip|dsft|psf) 4320 80% 43200 reload-into-ims
refresh_pattern -i microsoft.com/.*\.(cab|exe|ms[i|u|f]|[ap]sf|wm[v|a]|dat|zip|dsft|psf) 4320 80% 43200 reload-into-ims
refresh_pattern -i update.microsoft.com/.*\.(cab|exe|ms[i|u|f]|[ap]sf|wm[v|a]|dat|zip|dsft|psf) 4320 80% 43200 reload-into-ims
refresh_pattern -i windowsupdate.com/.*\.(cab|exe|ms[i|u|f]|[ap]sf|wm[v|a]|dat|zip|dsft|psf) 4320 80% 43200 reload-into-ims
refresh_pattern -i windows.com/.*\.(cab|exe|ms[i|u|f]|[ap]sf|wm[v|a]|dat|zip|dsft|psf) 4320 80% 43200 reload-into-ims
http_access allow all windowsupdate
# ACLs
acl acesso_liberado src "/etc/squid3/acls/acesso_liberado"
acl dominio_liberado dstdomain "/etc/squid3/acls/dominio_liberado"
acl ip_permitido src "/etc/squid3/acls/ip_permitido"
acl site_permitido url_regex -i "/etc/squid3/acls/site_permitido"
acl convenios url_regex -i "/etc/squid3/acls/convenios"
# ACLs de Bloqueio
#acl dominio_bloqueado dstdomain "/etc/squid3/acls/dominio_bloqueado"
#acl download_bloqueado urlpath_regex -i "/etc/squid3/acls/download_bloqueado"
#acl deny_rep_mime_flashvideo rep_mime_type -i video/flv
#acl deny_rep_mime_shockwave rep_mime_type -i ^application/x-shockwave-flash$
#acl fails rep_mime_type ^.*mms.*
#acl fails rep_mime_type ^.*ms-hdr.*
#acl fails rep_mime_type ^.*x-fcs.*
#acl fails rep_mime_type ^.*x-ms-asf.*
#acl fails2 urlpath_regex dvrplayer mediastream mms://
#acl fails2 urlpath_regex \.asf$ \.afx$ \.flv$ \.swf$
#acl x-type req_mime_type -i ^application/octet-stream$
#acl x-type req_mime_type -i application/octet-stream
#acl x-type req_mime_type -i ^application/x-mplayer2$
#acl x-type req_mime_type -i application/x-mplayer2
#acl x-type req_mime_type -i ^application/x-oleobject$
#acl x-type req_mime_type -i application/x-oleobject
#acl x-type req_mime_type -i application/x-pncmd
#acl x-type req_mime_type -i ^video/x-ms-asf$
#acl x-type2 rep_mime_type -i ^application/octet-stream$
#acl x-type2 rep_mime_type -i application/octet-stream
#acl x-type2 rep_mime_type -i ^application/x-mplayer2$
#acl x-type2 rep_mime_type -i application/x-mplayer2
#acl x-type2 rep_mime_type -i ^application/x-oleobject$
#acl x-type2 rep_mime_type -i application/x-oleobject
#acl x-type2 rep_mime_type -i application/x-pncmd
#acl x-type2 rep_mime_type -i ^video/x-ms-asf$
http_access allow acesso_liberado
http_access allow dominio_liberado
http_access allow site_permitido
http_access allow convenios
#http_access deny dominio_bloqueado !acesso_liberado
#http_access deny download_bloqueado !acesso_liberado !convenios !dominio_liberado !kaspersky !windowsupdate
#http_reply_access deny deny_rep_mime_flashvideo !acesso_liberado !convenios !dominio_liberado !kaspersky !windowsupdate
#http_reply_access deny deny_rep_mime_shockwave !acesso_liberado !convenios !dominio_liberado !kaspersky !windowsupdate
#http_access deny fails !acesso_liberado !convenios !dominio_liberado !kaspersky !windowsupdate
#http_reply_access deny fails !acesso_liberado !convenios !dominio_liberado !kaspersky !windowsupdate
#http_access deny fails2 !acesso_liberado !convenios !dominio_liberado !kaspersky !windowsupdate
#http_reply_access deny fails2 !acesso_liberado !convenios !dominio_liberado !kaspersky !windowsupdate
#http_access deny x-type !acesso_liberado !convenios !dominio_liberado !kaspersky !windowsupdate
#http_reply_access deny x-type !acesso_liberado !convenios !dominio_liberado !kaspersky !windowsupdate
#http_access deny x-type2 !acesso_liberado !convenios !dominio_liberado !kaspersky !windowsupdate
#http_reply_access deny x-type2 !acesso_liberado !convenios !dominio_liberado !kaspersky !site_permitido !windowsupdate
http_access allow ip_permitido
http_access deny all
http_port 5000
#dns_nameservers 200.175.89.139 200.175.5.139 #DNS da GVT
cache_mem 2048 MB
maximum_object_size_in_memory 512 KB
memory_replacement_policy heap GDSF
cache_replacement_policy heap GDSF
cache_dir aufs /var/spool/squid3/aufs/1 2048 16 256
cache_dir aufs /var/spool/squid3/aufs/2 2048 16 256
cache_dir aufs /var/spool/squid3/aufs/3 2048 16 256
cache_dir aufs /var/spool/squid3/aufs/4 2048 16 256
cache_dir aufs /var/spool/squid3/aufs/5 2048 16 256
minimum_object_size 0 KB
maximum_object_size 204800 KB
cache_swap_low 90
cache_swap_high 95
access_log /var/log/squid3/access.log squid
#logfile_rotate 0
#cache_log /var/log/squid3/cache.log
coredump_dir /var/spool/squid3
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Packages(.gz)*)$ 0 20% 2880
refresh_pattern . 0 20% 4320
# Integração NFS-e
ignore_expect_100 on
visible_hostname Suporte
delay_pools 0
icp_port 0
error_directory /usr/share/squid3/errors/pt-br
----------------------------------------------------------------------------------------
########## Iptables - Configurado através do Script ####################
#!/bin/bash
# Interface da Internet:
ifinternet="eth1"
# Interface da rede local
iflocal="eth0"
iniciar(){
modprobe iptable_nat
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o $ifinternet -j MASQUERADE
#iptables -A INPUT -p icmp --icmp-type echo-request -j DROP
echo 1 > /proc/sys/net/ipv4/conf/default/rp_filter
iptables -A INPUT -m state --state INVALID -j DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i $iflocal -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --syn -j DROP
}
parar(){
iptables -F
iptables -F -t nat
}
case "$1" in
"start") iniciar ;;
"stop") parar ;;
"restart") parar; iniciar ;;
*) echo "Use os parâmetros start ou stop"
esac
-------------------------------------------------------------