[Inclusão Digital]Squid + Marcação de Pacotes

Rôney Eduardo Oliveira Santos roneyeduardosantos em gmail.com
Terça Julho 13 19:59:49 BRT 2010


Pra ficar mais fácil:

 - Muda o eth1:0 para 10.0.0.123 (exemplo)
 - No squid: tcp_outgoing_address 10.0.0.123 youtube

 - No Mikrotik: /ip firewall nat add chain=srcnat out-interface=WAN_LINK
src-address=10.0.0.123 dst-address=0.0.0.0/0 action=src-nat
to-address=A.B.C.D

Onde: WAN_LINK é a interface conectada com o link pelo qual você quer que
saia as requisições para o youtube; A.B.C.D é um IP deste link.

[]'s

Rôney Eduardo




2010/7/13 JairJunior.net <jair em jairjunior.net>

> eth0      Link encap:Ethernet  HWaddr 00:14:2A:02:06:F8
>          inet addr:192.168.0.251  Bcast:192.168.0.255  Mask:255.255.255.0
>          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>          RX packets:700705 errors:0 dropped:0 overruns:0 frame:0
>          TX packets:894170 errors:0 dropped:0 overruns:0 carrier:0
>          collisions:0 txqueuelen:1000
>          RX bytes:97862278 (93.3 MiB)  TX bytes:724551890 (690.9 MiB)
>          Interrupt:11 Base address:0xd800
>
> eth1      Link encap:Ethernet  HWaddr 00:08:54:2E:8E:BE
>          inet addr:10.0.0.2  Bcast:10.0.0.255  Mask:255.255.255.0
>          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>          RX packets:664622 errors:0 dropped:0 overruns:0 frame:0
>          TX packets:635144 errors:0 dropped:0 overruns:0 carrier:0
>          collisions:0 txqueuelen:1000
>          RX bytes:489606551 (466.9 MiB)  TX bytes:93195443 (88.8 MiB)
>          Interrupt:10 Base address:0xdc00
>
> eth1:0    Link encap:Ethernet  HWaddr 00:08:54:2E:8E:BE
>          inet addr:10.0.1.2  Bcast:10.255.255.255  Mask:255.255.255.0
>          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>          Interrupt:10 Base address:0xdc00
>
> lo        Link encap:Local Loopback
>          inet addr:127.0.0.1  Mask:255.0.0.0
>          UP LOOPBACK RUNNING  MTU:16436  Metric:1
>          RX packets:11149 errors:0 dropped:0 overruns:0 frame:0
>          TX packets:11149 errors:0 dropped:0 overruns:0 carrier:0
>          collisions:0 txqueuelen:0
>          RX bytes:1122790 (1.0 MiB)  TX bytes:1122790 (1.0 MiB)
>
> Jair Júnior
> Power Soft Informática e Tecnologia
> jair em pstecnologia.com.br
> www.pstecnologia.com.br
>
>
> Em 13 de julho de 2010 19:21, Rôney Eduardo Oliveira Santos <
> roneyeduardosantos em gmail.com> escreveu:
>
> > Exporta um ifconfig ai pra gente...
> >
> > []'s
> >
> > Rôney Eduardo
> >
> >
> > 2010/7/13 JairJunior.net <jair em jairjunior.net>
> >
> > > Coloquei 2 vezes:
> > > acl youtube dstdomain youtube.com
> > > tcp_outgoing_address 10.0.1.2 youtube
> > >
> > > mas foi só na hora de copiar do putty, o correto é o primeiro.
> > >
> > > Jair Júnior
> > > Power Soft Informática e Tecnologia
> > > jair em pstecnologia.com.br
> > > www.pstecnologia.com.br
> > >
> > >
> > > Em 13 de julho de 2010 18:30, JairJunior.net <jair em jairjunior.net>
> > > escreveu:
> > >
> > > > Aqui ta saindo sempre pelo mesmo IP:
> > > >
> > > > A eth1 tá com os ips 10.0.0.2 e 10.0.1.2 o default é 10.0.0.2 e ta
> > saindo
> > > > tudo por ele.
> > > > Pelo menos é o que vejo através do TORCH na interface do MK!
> > > >
> > > > segue squid.conf:
> > > >
> > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------------------------------------------
> > > >
> > > > http_port 8080 transparent
> > > > icp_port 0
> > > > hierarchy_stoplist cgi-bin ?
> > > >         acl QUERY urlpath_regex cgi-bin \?
> > > >         cache deny QUERY
> > > > cache_replacement_policy heap LFUDA
> > > > memory_replacement_policy heap GDSF
> > > > cache_mem 200 MB
> > > >         maximum_object_size 40000 KB
> > > >         minimum_object_size 4 KB
> > > >         maximum_object_size_in_memory 64 KB
> > > > cache_dir diskd /partition/squid/cache 10000 16 256 Q1=72 Q2=64
> > > > access_log /partition/squid/logs/access.log
> > > > cache_log /partition/squid/logs/cache.log
> > > > cache_store_log none
> > > >
> > > > cache_effective_user nobody
> > > > cache_effective_group nogroup
> > > > pid_filename /var/run/squid.pid
> > > > half_closed_clients off
> > > > server_persistent_connections off
> > > > client_persistent_connections off
> > > > memory_pools on
> > > > buffered_logs on
> > > > pipeline_prefetch on
> > > >
> > > > dns_retransmit_interval 15 seconds
> > > >
> > > > #cache_swap_low 70
> > > > #cache_swap_high 90
> > > >
> > > > refresh_pattern -i ^http://.*\.(css|htm|html|ico|js|jsp|xml)$ 1440
> 80%
> > > > 999999
> > > > refresh_pattern -i ^http://.*\.(bmp|gif|jpeg|jpg|png)$ 1440 80%
> 999999
> > > > ignore-re
> > > > refresh_pattern -i ^http://
> > > > .*\.(ace|adt|arj|asf|avi|bin|bz2|bzip|cab|dat|dll|doc
> > > >
> > > > refresh_pattern ^ftp:   1440    20%     10080
> > > > refresh_pattern ^gopher:        1440    0%      1440
> > > > refresh_pattern .               0       20%     4320
> > > >
> > > >
> > > > acl youtube dstdomain youtube.com
> > > > tcp_outgoing_address 10.0.1.2 youtube
> > > >
> > > >
> > > > acl all src 0.0.0.0/0.0.0.0
> > > > acl localhost src 127.0.0.1/255.255.255.255
> > > > buffered_logs on
> > > > pipeline_prefetch on
> > > >
> > > > dns_retransmit_interval 15 seconds
> > > >
> > > > #cache_swap_low 70
> > > > #cache_swap_high 90
> > > >
> > > > refresh_pattern -i ^http://.*\.(css|htm|html|ico|js|jsp|xml)$ 1440
> 80%
> > > > 999999
> > > > refresh_pattern -i ^http://.*\.(bmp|gif|jpeg|jpg|png)$ 1440 80%
> 999999
> > > > ignore-reload
> > > > refresh_pattern -i ^http://
> > > >
> > >
> >
> .*\.(ace|adt|arj|asf|avi|bin|bz2|bzip|cab|dat|dll|doc|dot|exe|fla|flv|gz|iso|lha|log|lzh|mdb|mid|m
> > > >
> > > > refresh_pattern ^ftp:   1440    20%     10080
> > > > refresh_pattern ^gopher:        1440    0%      1440
> > > > refresh_pattern .               0       20%     4320
> > > >
> > > >
> > > > acl youtube dstdomain youtube.com
> > > > tcp_outgoing_address 10.0.1.1 youtube
> > > >
> > > >
> > > > acl all src 0.0.0.0/0.0.0.0
> > > > acl localhost src 127.0.0.1/255.255.255.255
> > > > #acl to_localhost dst 127.0.0.1/32
> > > >
> > > >
> > > >
> > > > acl SSL_ports port 443 563
> > > > acl Safe_ports port 80
> > > > acl Safe_ports port 21
> > > > acl Safe_ports port 443 563
> > > > acl Safe_ports port 70
> > > > acl Safe_ports port 210
> > > > acl Safe_ports port 8180
> > > > acl Safe_ports port 1025-65535
> > > > acl Safe_ports port 280
> > > > acl Safe_ports port 488
> > > > acl Safe_ports port 591
> > > > acl Safe_ports port 777
> > > > acl Safe_ports port 901
> > > >
> > > > acl manager proto cache_object
> > > > acl PURGE method PURGE
> > > > acl CONNECT method CONNECT
> > > >
> > > > http_access allow PURGE localhost
> > > > http_access allow manager localhost
> > > > http_access deny PURGE
> > > > http_access deny manager
> > > > http_access deny !Safe_ports
> > > > http_access deny CONNECT !SSL_ports
> > > > acl filterneg dstdom_regex "/usr/local/squid/etc/filter.flt"
> > > > acl block url_regex -i "/usr/local/squid/etc/block.flt"
> > > > acl internal_net src "/usr/local/squid/etc/ipaccess.yes"
> > > >
> > > > #Access deny to Squid ident. header
> > > > header_access Via deny all
> > > > header_access X-Forwarded-For deny all
> > > > header_access Proxy-Connection deny all
> > > > header_access Accept-Encoding deny all
> > > > http_access deny filterneg
> > > > http_access deny block
> > > > http_access allow internal_net
> > > > http_access deny all
> > > > #http_reply_access allow all
> > > > #icp_access allow all
> > > > acl apache rep_header Server ^Apache
> > > > broken_vary_encoding allow apache
> > > > visible_hostname brazilfw
> > > >         coredump_dir /partition/squid/cache
> > > >         error_directory /usr/local/squid/share/errors/English
> > > >
> > > >
> > > > -----------------------------------------
> > > >
> > > >
> > > > Jair Júnior
> > > > Power Soft Informática e Tecnologia
> > > > jair em pstecnologia.com.br
> > > > www.pstecnologia.com.br
> > > >
> > > >
> > > > Em 13 de julho de 2010 18:16, Rôney Eduardo Oliveira Santos <
> > > > roneyeduardosantos em gmail.com> escreveu:
> > > >
> > > > Só uma correção, o parâmetro correto é tcp_outgoing_address.
> > > >>
> > > >> []'s
> > > >>
> > > >> Rôney Eduardo
> > > >>
> > > >>
> > > >>
> > > >> 2010/7/13 Rôney Eduardo Oliveira Santos <
> roneyeduardosantos em gmail.com
> > >
> > > >>
> > > >> > Do PC que tá o squid. Ai no seu gateway MikroTik você faz NAT
> nesse
> > IP
> > > >> pra
> > > >> > sair pelo link que você quer.
> > > >> >
> > > >> >
> > > >> > []'s
> > > >> >
> > > >> > Rôney Eduardo
> > > >> >
> > > >> >
> > > >> > 2010/7/13 JairJunior.net <jair em jairjunior.net>
> > > >> >
> > > >> >> Onde vc fala: tcp_ougoing_address 192.168.Y.X youtube esse ip
> seria
> > > do
> > > >> MK
> > > >> >> ou
> > > >> >> do pc que está o squid??
> > > >> >>
> > > >> >> Jair Júnior
> > > >> >> Power Soft Informática e Tecnologia
> > > >> >> jair em pstecnologia.com.br
> > > >> >> www.pstecnologia.com.br
> > > >> >>
> > > >> >>
> > > >> >> Em 13 de julho de 2010 16:56, Rôney Eduardo Oliveira Santos <
> > > >> >> roneyeduardosantos em gmail.com> escreveu:
> > > >> >>
> > > >> >> > Olá,
> > > >> >> >
> > > >> >> > Você não precisa marcar os pacotes, basta você fazer o squid
> sair
> > > por
> > > >> um
> > > >> >> > determinado IP quando o destino for youtube.com, com as
> > seguintes
> > > >> >> linhas:
> > > >> >> >
> > > >> >> > --
> > > >> >> > acl youtube dstdomain youtube.com
> > > >> >> > acl youtube dstdomain googlevideos.com
> > > >> >> >
> > > >> >> > tcp_ougoing_address 192.168.Y.X youtube
> > > >> >> > --
> > > >> >> >
> > > >> >> > Você só precisa se certificar de duas coisas:
> > > >> >> >
> > > >> >> > 1) que o servidor tenha esse IP configurado (um alias);
> > > >> >> > 2) que você também tenha no seu squid.conf a diretiva
> > > >> >> > "server_persistent_connections off"
> > > >> >> >
> > > >> >> > Com isso, no seu gateway mikrotik você faz NAT desse IP para o
> > link
> > > >> >> > desejado.
> > > >> >> >
> > > >> >> > Você pode extender isso também para outros tipos de acl
> > suportadas
> > > >> pelo
> > > >> >> > squid, como "url_regex", "src", "dst", etc...
> > > >> >> >
> > > >> >> > []'s
> > > >> >> >
> > > >> >> > Rôney Eduardo
> > > >> >> >
> > > >> >> >
> > > >> >> >
> > > >> >> > 2010/7/13 JairJunior.net <jair em jairjunior.net>
> > > >> >> >
> > > >> >> > > Olá pessoal, alguem sabe se tem como marcar pacotes pelo
> squid
> > > para
> > > >> >> por
> > > >> >> > > exemplo marcar todos os pacotes para *.youtube.com para
> depois
> > > >> >> > direcionar
> > > >> >> > > pelo MK pra um segundo link????
> > > >> >> > >
> > > >> >> > > Jair Júnior
> > > >> >> > > Power Soft Informática e Tecnologia
> > > >> >> > > jair em pstecnologia.com.br
> > > >> >> > > www.pstecnologia.com.br
> > > >> >> > > _______________________________________________
> > > >> >> > > Inclusaodigital mailing list
> > > >> >> > > Inclusaodigital em anid.com.br
> > > >> >> > > http://anid.com.br/mailman/listinfo/inclusaodigital
> > > >> >> > >
> > > >> >> > _______________________________________________
> > > >> >> > Inclusaodigital mailing list
> > > >> >> > Inclusaodigital em anid.com.br
> > > >> >> > http://anid.com.br/mailman/listinfo/inclusaodigital
> > > >> >> >
> > > >> >> _______________________________________________
> > > >> >> Inclusaodigital mailing list
> > > >> >> Inclusaodigital em anid.com.br
> > > >> >> http://anid.com.br/mailman/listinfo/inclusaodigital
> > > >> >>
> > > >> >
> > > >> >
> > > >> _______________________________________________
> > > >> Inclusaodigital mailing list
> > > >> Inclusaodigital em anid.com.br
> > > >> http://anid.com.br/mailman/listinfo/inclusaodigital
> > > >>
> > > >
> > > >
> > > _______________________________________________
> > > Inclusaodigital mailing list
> > > Inclusaodigital em anid.com.br
> > > http://anid.com.br/mailman/listinfo/inclusaodigital
> > >
> > _______________________________________________
> > Inclusaodigital mailing list
> > Inclusaodigital em anid.com.br
> > http://anid.com.br/mailman/listinfo/inclusaodigital
> >
> _______________________________________________
> Inclusaodigital mailing list
> Inclusaodigital em anid.com.br
> http://anid.com.br/mailman/listinfo/inclusaodigital
>


Mais detalhes sobre a lista de discussão Inclusaodigital