-
Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
Olá galera do Under, resolvi pedir arrego e ajuda.
Depois de umas 3 semanas literalmente dia e noite tentando colocar o Squid para funcionar na topologia acima, venho pedir ajuda.
Já estou quase ficando louco com isso, já que simplesmente o Squid bloqueia algumas páginas, e de repente, como se abrisse a porteira, passam a funcionar por minutos.
As páginas que nao abrem: Google, Facebook, Yahoo, Msn, Youtube, entre outros portais.
Eu quero deixar o servidor em Bridge para colocar a RB450G para fazer o controle de banda dos clientes (se for possível e viável).
Minha topologia hoje está assim:
Modem ADSL >> (Servidor) Squid com Tproxy (em bridge) >> Switch >> Computadores.
A ideia é configurar a RB450G para ela ficar antes do servidor e no início de abril, quando espero começar a trabalhar, já tenha a fibra instalada e funcionando (amanha instalam o router aqui).
Segui o tutorial do Marcelo Gondim e tive um êxito parcial, ou seja, funciona, mas bloqueia as páginas acima e mais algumas.
squid_tproxy
Segue o squid.conf
cache_effective_user proxy
cache_effective_group proxy
access_log /var/log/squid/access.log squid
cache_store_log /var/log/squid/store.log
cache_log /var/log/squid/cache.log
#
# Recommended minimum configuration:
#
# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 192.168.1.0/24 # RFC1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
acl SSL_ports port 443
acl Safe_ports port 80 # http
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 Safe_ports port 901 # Swat
acl CONNECT method CONNECT
#
# Recommended minimum Access Permission configuration:
#
# Only allow cachemgr access from localhost
http_access allow localhost manager
http_access deny manager
# Deny requests to certain unsafe ports
http_access deny !Safe_ports
# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports
# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost
#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#
# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost
# And finally deny all other access to this proxy
http_access deny all
# Squid normally listens to port 3128
http_port 3128
http_port 3129 tproxy
# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /cache/ 30000 64 256
# Leave coredumps in the first cache dir
coredump_dir /cache
# Add any of your own refresh_pattern entries above these.
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
As regras do iptables, ebtables eu fiz iguais as do tutorial. Já pesquisei bastante, e muita gente teve o mesmo problema, embora sem solução, e um dos erros que dá no access.log é TCP_Miss. Também não permite acessar páginas no servidor, como o squid-reports e nem a página inicial do Apache.
Gostaria de tentar fazer isso funcionar para colocar mais regras como Wupdate e afins, tentar acertar o Cache Full (ZPH) e demais regras.
Uso Linux Debian 6.0.4 64 bits com o último kernel já com suporte a Tproxy e Squid 3.2.0.16.
PS. Continuo com essa versão do Squid ou tento mudar a versão?
Desculpem pelo post longo, mas tentei deixar detalhado o meu problema.
Grato antecipado pela atenção,
Velhinho.
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
Amigo como vc esta fazendo as ligações na rede dos seus equipamentos, passa o esquema de ligação da sua rede
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
Valeu pela resposta Demattos.
Tá funcionando assim:
Modem ADSL > Servidor em ponte > Switch > Computadores.
O Modem está roteado fazendo a discagem e o NAT, o servidor está em bridge passando o ip do Modem, que também é o gateway da rede. O ping funciona normalmente, o DHCP Client também, já que as máquinas estão pegando ip.
O Servidor está com duas placas de rede em modo bridge, a eth0 recebe o cabo de rede do modem e a eth1 manda para o switch.
o meu /etc/network/interface está assim:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
auto br0
iface br0 inet static
address 192.168.1.2
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
bridge_ports eth0 eth1
post-up route add -net 192.168.1.0/24 gw 192.168.1.1
O estranho é que de momentos em momentos os portais abrem, como agora, acabei de reiniciar o servidor e a página do google abriu, mas a do servidor não.
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
Bom, por algum motivo alheio aos meus fuçamentos, aparentemente voltou a funcionar, só que o Facebook ainda abre com restrições, não abro nenhuma página no servidor (ou seja, meu squid-reports do sarg tá morto) e por ai vai.
Alguém sabe qual regra eu tenho que modificar/criar para permitir que as máquinas da minha rede acessem as páginas hospedadas no servidor?
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
Amigo posta ai... o seu firewall acho que voce esta fechando alguma porta...
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
Hoje já me falha algumas páginas, curiosamente no meu notebook, mas vamos lá.
Iptables em /root/frw1.sh (com chmod +x)
Código :
#!/bin/bash
iptables -F -t mangle
iptables -X -t mangle
iptables -t mangle -N DIVERT
iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT
iptables -t mangle -A DIVERT -j MARK --set-mark 1
iptables -t mangle -A DIVERT -j ACCEPT
iptables -t mangle -A PREROUTING -p tcp --dport 80 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3129
ebtables em /root/frw2.sh (idem ao iptables)
Código :
#!/bin/bash
ebtables -t broute -A BROUTING -i eth1 -p ipv4 --ip-proto tcp --ip-dport 80 -j redirect --redirect-target ACCEPT
ebtables -t broute -A BROUTING -i eth0 -p ipv4 --ip-proto tcp --ip-sport 80 -j redirect --redirect-target ACCEPT
cd /proc/sys/net/bridge/
for i in *
do
echo 0 > $i
done
unset i
Não acho que o firewall esteja brecando, mas... também não tenho certeza rsss.
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
eu tive um problema parecido com esse. mais era no meu caso o msn.
o seu squid.conf esta exatamente como voce postou aqui ? se tiver intao vamos precisar reorganizar ele... como eu disse eu ja tive um problema parecido ... e era só questao de organizacao ...!
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
aproveita e posta aqui a saida do tail em tail -f /var/log/squid/access.log
com o erro..!!!
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
Aparentemente nao acusa erro, mais fica ai, a página aguardando... algumas dao timeout, outras ficam eternamente carregando...
Código :
1332976425.980 470771 192.168.1.36 NONE_ABORTED/000 0 GET http://connect.facebook.net/pt_BR/all.js? - HIER_NONE/- -
1332976425.980 470771 192.168.1.36 NONE_ABORTED/000 0 GET http://platform.twitter.com/widgets.js? - HIER_NONE/- -
1332976425.981 464338 192.168.1.36 NONE_ABORTED/000 0 GET http://b.scorecardresearch.com/r? - HIER_NONE/- -
1332976426.136 551 192.168.1.36 TCP_MISS/200 3384 GET http://bs.serving-sys.com/BurstingPipe/adServer.bs? - ORIGINAL_DST/63.241.108.124 text/html
1332976428.139 484839 192.168.1.36 NONE_ABORTED/000 0 GET http://view.atdmt.com/912/iview/388848337/direct/01bRcvNyq,bhxhgkpgxINrk? - HIER_NONE/- -
1332976428.139 472917 192.168.1.36 NONE_ABORTED/000 0 GET http://connect.facebook.net/pt_BR/all.js? - HIER_NONE/- -
1332976428.139 458110 192.168.1.36 NONE_ABORTED/000 0 GET http://profile.ak.fbcdn.net/static-ak/rsrc.php/v1/yo/r/UlIqmHJn-SK.gif - HIER_NONE/- -
1332976428.139 458115 192.168.1.36 NONE_ABORTED/000 0 GET http://a0.twimg.com/profile_images/1284021349/limao1_normal.jpg - HIER_NONE/- -
1332976428.141 488395 192.168.1.36 NONE_ABORTED/000 0 GET http://b.scorecardresearch.com/r? - HIER_NONE/- -
1332976428.141 472919 192.168.1.36 NONE_ABORTED/000 0 GET http://platform.twitter.com/widgets.js? - HIER_NONE/- -
Valeu pela ajuda newboy :)
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
Aqui o resultado quando funciona, como por exemplo, a página do uol
Código :
1332976628.345 959 192.168.1.36 TCP_MISS/200 10160 GET http://images1.folha.com.br/livraria/images/6/3/1023236-100x100.png - ORIGINAL_DST/200.147.118.36 image/png
1332976628.564 1175 192.168.1.36 TCP_MISS/200 14750 GET http://images1.folha.com.br/livraria/images/9/3/1177076-100x100.png - ORIGINAL_DST/200.147.118.36 image/png
1332976628.619 1230 192.168.1.36 TCP_MISS/200 13362 GET http://images1.folha.com.br/livraria/images/7/6/1177027-100x100.png - ORIGINAL_DST/200.147.118.36 image/png
1332976628.661 1272 192.168.1.36 TCP_MISS/200 11882 GET http://images1.folha.com.br/livraria/images/7/1/1174393-100x100.png - ORIGINAL_DST/200.147.118.36 image/png
1332976628.690 1300 192.168.1.36 TCP_MISS/200 9074 GET http://images1.folha.com.br/livraria/images/9/f/1172589-100x100.png - ORIGINAL_DST/200.147.118.36 image/png
1332976628.712 891 192.168.1.36 TCP_MISS/200 646 GET http://bn.uol.com.br/js.ng/site=folha&chan=homepage&size=635x50&page=1&expble=1&conntype=1&tile=0005070437? - ORIGINAL_DST/200.147.35.201 application/x-javascript
1332976628.835 987 192.168.1.36 TCP_MISS/200 8691 GET http://media.folha.uol.com.br/furniture/players/audio-5.swf - ORIGINAL_DST/200.147.1.152 application/x-shockwave-flash
1332976628.968 1579 192.168.1.36 TCP_MISS/200 4409 GET http://f.i.uol.com.br/fotografia/2011/07/06/68758-970x600-1-medium.jpeg - ORIGINAL_DST/200.147.68.8 image/jpeg
1332976629.053 1665 192.168.1.36 TCP_MISS/200 6169 GET http://f.i.uol.com.br/fotografia/2011/07/06/68744-970x600-1-medium.jpeg - ORIGINAL_DST/200.147.68.8 image/jpeg
1332976629.361 1013 192.168.1.36 TCP_MISS/200 13896 GET http://images1.folha.com.br/livraria/images/9/2/1021455-100x100.png - ORIGINAL_DST/200.147.118.36 image/png
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
Eu ja fiz um para testes em bancada usando um tutorial no vivaolinux.com.br e tive bastante probblema foi para ajustar a tabela de roteamento que tem q ser feita para funcionar legal, outra coisa e testar se a internet esta funcionando perfeitamente no proprio server e verificar os dns estao corretos para testes
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
voce tem mais de um link da rede ? ou seja um load balance ?
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
ta complicado mais acho que é alguma coisa com autenticacao na porta 443 SSL.
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
porta 443 nao eh por que ele nao eh rederecionado para o squid ....
pelo o que deu de notar ai nos logs do squid tem coisa errada somente olhando mais de perto pra saber o que eh .....
esse eh um dos problema do squid em bridge ele aparece varios bugs ..
por que vc nao faiz roteado velho coloca o squid como seu gateway de borda ?
abraço
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
bom.... ele disse que o facebook é a que mais tem problema... ela trabalha somente via 443 ... https.!
ainda acho que tem algo ai com a 443
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
Por partes hehe.
Pensei em colocar como bridge porque resolveria um problema que tive, tentando fazer o mesmo servico para um cliente, mas como ele cancelou, posso mudar o meu aqui sem crise.
Só tenho um link ADSL que estou usando no momento, até o pessoal liberar a fibra, o meu roteador foi instalado hoje, mas ainda nao me liberaram para usar.
A conexao vem direto do modem ADSL para o servidor em bridge, dai passaria para o switch e os demais computadores.
O que sai como https funciona normal, inclusive a página do google.
Qual seria a alternativa no meu caso (posso me desfazer do bridge). Deixar as duas ethernet e fazer um nat (já consegui fazer funcionar assim), e fazer um servidor dhcp também?
Posso deixar a eth0 conectada ao modem com ip estático, e a eth1 com ip estático também, mas fazendo o papel de DHCP Server, e fazer as tabelas de roteamento como nat, mas ai, como ficaria?
Grato pela atencao e ajuda de todos.
Velhinho.
PS. Para acessar aqui tenho que furar o meu proprio proxy e usar via tor, é mole? rss
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
ficaria assim...
voce iria reinstalar essa maquina... iria colocar eth0 com ip estatico...
iria usar a eth1 com ip estatico ... e tambem usaria o dhcp sem problemas..
voce iria redirecionar o trefego da 80 para 3128 ou 3129 sua preferencia.
eu nao te aconselho a fazer transparente aqui.. onde eu faco esse trabalho tive varios problemas com softwares que quebravam meus bloqueios...
mais voce que sabe oque voce escolher vamos te ajudar.! valew abraco.!
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
sim sem probema nenhum fazer nada eh usar 1 dhcp-server nele ...
a parte de fazer a tabela de roteamento eh simples coloque na eth de saida do cliente o mesmo ip deu roteador adsl hj ..... soh que lembrando vc nao podera usar a mesma range de ip no modem adsl troque ele por outra range ...
o que vc quiz dizer com tor ? nao entendi
abraço
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
Citação:
Postado originalmente por
newboy
ficaria assim...
voce iria reinstalar essa maquina... iria colocar eth0 com ip estatico...
iria usar a eth1 com ip estatico ... e tambem usaria o dhcp sem problemas..
voce iria redirecionar o trefego da 80 para 3128 ou 3129 sua preferencia.
eu nao te aconselho a fazer transparente aqui.. onde eu faco esse trabalho tive varios problemas com softwares que quebravam meus bloqueios...
mais voce que sabe oque voce escolher vamos te ajudar.! valew abraco.!
No meu caso teria que ser transparente também, porque nao vou poder configurar cliente por cliente (estou comecando meu provedor :D ).
Logo nao teria problema que um ou outro furasse o cache, o importante é que funcionasse como o tal do "cache full" :D
Citação:
Postado originalmente por
Pupa
sim sem probema nenhum fazer nada eh usar 1 dhcp-server nele ...
a parte de fazer a tabela de roteamento eh simples coloque na eth de saida do cliente o mesmo ip deu roteador adsl hj ..... soh que lembrando vc nao podera usar a mesma range de ip no modem adsl troque ele por outra range ...
o que vc quiz dizer com tor ? nao entendi
abraço
Vou fazer isso entao, jogo um ip para a eth0 que está no mesmo range do modem, e na eth1 um novo range diferente do range do modem correto? Entao minha ipcam teria que ficar no mesmo range dos equipamentos da rede local, que estarao conectados a eth1, depois tento fazer redirecionamento para que possa ser acessada da internet, acho um problema menor.
Se eu colocar a RB450G para fazer o controle dos clientes, alteraria alguma coisa ou nao?
E do tor, é o torproject, o navegador que vem com um proxy configurado para navegar anonimamente, ele nao usa a porta 80 para se conectar, logo fura o proxy local. Acho que é um dos programas que o newboy listou como problema rsss.
Abracos e obrigado pela ajuda, vou voltar a configuracao antiga (sem brigde).
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
sim nao seria isso mesmo ... era isso mesmo que vc tem que fazer quanto ao acesso a sua camera teria que fazer um rederecionamento de porta nao vejo problema nenhum nisso amigo ...
quando vc colcar a sua rb ai as coisa muda
modem ---------rb------------swicth
* |
* |
* |
* squid
entao nesse caso seu squid ficaria em paralelo com rb ai sim vc poderia fazer o tal do cache fulll
mais quando fazer isso troca seu OS para Freebsd .
abraço
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
Amigo deixa eu te dar uma ideia... com todo respeito pelo seu projeto. nao
me leve a mau... mais oque voce acha de usar um brasilfw ? hoje em dia a maioria dos provedores de internet usam brasilfw. com ele voce poderia ter o controle de banda,firewall,proxy tudo em uma unica maquina. e ainda poderia ate criar uma bridge para o próprio brasilfw autenticar no seu provedor.
acho que seria mais pratico,facil e bem mais seguro.
é só uma ideia... como eu ja disse oque voce escolher estaremos aqui para te ajudar
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
Aos colegas que estavam me ajudando, peco desculpas por nao ter respondido antes, comecei a correria com ativacao e finalizacao do link (já está funcionando) e para terminar a caixa e subir na torre, mas felizmente, gracas a Deus está tudo funcionando e instalado, espero nao subir mais na torre para mexer em equipamento, só quando for ampliar :)
Voltando ao caso:
No inicio, meu problema era que estava tentando montar um servidor de proxy para um cliente, e ele tem duas redes diferentes, em uma, queria que o proxy passasse as configuracoes da RB direto aos aps, funcionando apenas como proxy/cache. No outro, eu tinha um DVR que deveria ser acessado pela rede local e pela internet. Com o servidor em brigde, achei que resolveria meu problema, mas o cliente cancelou e hoje posso montar o meu cache como quiser, mas tinha gostado da ideia do bridge, embora agora posso acomodar como for mais conveniente.
Citação:
Postado originalmente por
Pupa
sim nao seria isso mesmo ... era isso mesmo que vc tem que fazer quanto ao acesso a sua camera teria que fazer um rederecionamento de porta nao vejo problema nenhum nisso amigo ...
quando vc colcar a sua rb ai as coisa muda
modem ---------rb------------swicth
* |
* |
* |
* squid
entao nesse caso seu squid ficaria em paralelo com rb ai sim vc poderia fazer o tal do cache fulll
mais quando fazer isso troca seu OS para Freebsd .
abraço
Vou montar a minha rede definitiva hoje (ou por esses final de semana), e da forma como voce sugeriu, quem fica como servidor DHCP, a RB?
Ligo o Servidor conectado diretamente ao Router Cisco (já cancelei o Speedy), ou ligo o Servidor a RB? Hoje vindo para o provedor e pensando na tua ideia vi que teria que ligar a RB antes do Switch, mas fiquei com dúvidas de onde ligar o servidor.
Vou ter ganho de desempenho passando para o FreeBSD? Nao sei utilizar o sistema, mas nao tenho problema em aprender, afinal, deve ter algo parecido com Linux rsss.
Abracos e obrigado pela ajuda.
Citação:
Postado originalmente por
newboy
Amigo deixa eu te dar uma ideia... com todo respeito pelo seu projeto. nao
me leve a mau... mais oque voce acha de usar um brasilfw ? hoje em dia a maioria dos provedores de internet usam brasilfw. com ele voce poderia ter o controle de banda,firewall,proxy tudo em uma unica maquina. e ainda poderia ate criar uma bridge para o próprio brasilfw autenticar no seu provedor.
acho que seria mais pratico,facil e bem mais seguro.
é só uma ideia... como eu ja disse oque voce escolher estaremos aqui para te ajudar
Respeito tua ideia sim newboy, inclusive pensei no BrazilFW no inicio, mas nao tive a ideia que poderia usar o servidor para tudo, pensei que teria que ter duas máquinas, uma para BFW e outra para servidor de cache. Facilitaria minha vida com ele?
Abracos e obrigado pela ajuda.
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
Opa Boa tarde...
sim voce vai precisar de 2 servidores 1 com o bfw e outro com o servidor de cache.
só uma duvida qual software voce vai usar para fazer o cache ?
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
Boa tarde newboy.
Bom, sinceramente ainda estou em dúvida, estou optando entre o Nimoc e o Thundercache, o que eu conseguir utilizar melhor para testar eu abarco. Alguma sugestao? :)
Abracos.
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
speed R ,Thundercache
speed se o seu Hardware for 64 bts.!
:)
-
Re: Squid (Debian Squeeze) Transparente em bridge - Não abre alguma páginas
Boa noite, desculpem a demora, mas vim dar um feedback.
Fui de Thunder (pensei no Nimoc, mas algumas decisoes nao técnicas me fizeram optar pelo Thunder. No futuro penso em dar uma chance ao Nimoc).
Agora estou tentando configurar tudo para fazer o tal do "full cache" e ver se sou feliz no intento rss.
Por hora, vou ter que desistir do Squid, mas no futuro volterei com tempo tentar fazer funcionar o que nao consegui nesse último mes.
Acho que posso dar por encerrado/resolvido aqui. Agradeco a todos que se propuseram a me ajudar :)
Obrigado a todos.
EribertoTorres