Para provedor de internet, o ideal seria utilizar dummynet. Em 28/1/2007, "Cristina Fernandes Silva" <[EMAIL PROTECTED]> escreveu:
>Pessoal, > >Sei que ja foi muito discutido aqui na lista, mas estou a maior duvida,vou >implementar um servidor >voltado para um pequeno provedor de internet e estou precisando de um controle >de banda eficaz, >estou tentando fazer em PF, eis o pf.conf > >#----------------------------- >int_int="rl0" >int_ext="vr0" >rede="172.168.0.0" > >PING = "echoreq" >TCP_IN = "{ ssh, ftp, 20, 21, 443 }" >UDP_IN = "{ }" > > >TCP_OUT = "{ ssh, 20, 21, ftp, http, 443, ntp, 8080, 5999 }" >UDP_OUT = "{ domain, ntp }" > ># Link >down="512Kb" >uplo="512Kb" > >server1="127.0.0.1" >#---------------------------------------------------------------------------- ># tabela de Ips internos > >table <baixa> { 172.168.0.2, 172.168.0.3, 172.168.0.5, 172.168.0.9, >172.168.0.10, 172.168.0.13, >172.168.0.15, 172.168.0.16, 172.168.0.17, 172. >168.0.18 } > ># normalizando os pacotes >#---------------------------------------- >set timeout { tcp.first 60 tcp.opening 15 tcp.established 86400 \ > tcp.closing 300 tcp.finwait 15 tcp.closed 15 } >set timeout { udp.first 30 udp.single 15 udp.multiple 30 } >set timeout { icmp.first 10 icmp.error 5 } >set limit { states 50000 frags 25000 } >set optimization aggressive >set loginterface $int_ext >set loginterface $int_int >set block-policy return >set require-order yes >scrub all fragment reassemble random-id no-df > ># Habilita enfileiramento >#------------------------------------------------ > >altq on $int_int bandwidth $down cbq queue { normal_in baixa_in } > queue normal_in bandwidth 256Kb priority 0 cbq(default borrow red) > queue baixa_in bandwidth 128Kb priority 1 cbq(borrow red) > > >altq on $int_ext bandwidth $uplo cbq queue { normal_on baixa_on } > queue normal_on bandwidth 256Kb priority 0 cbq(default) > queue baixa_on bandwidth 128Kb priority 1 > ># Fazendo o NAT >nat on $int_ext inet from $int_int:network to any ->($int_ext) > > ># Redicrecionamento >#-------------------------------- >rdr on $int_int inet proto tcp from any to $int_ext port 80 -> 127.0.0.1 port >3128 > ># bloqueando spoof >antispoof for { $int_ext } inet > ># bloqueando scanners >block drop in quick on { $int_int } from any os { NMAP } > >#Liberando loopback >pass quick on lo0 all > ># liberando ping/traceroute >pass out log on $int_ext inet proto icmp all icmp-type 8 code 0 keep state >pass in log on $int_ext inet proto icmp all icmp-type 8 code 0 keep state > ># Liberando portas >#INCOMING >#TCP >pass in quick on $int_ext inet proto tcp from any to $int_ext port $TCP_IN >flags S/SA keep state >#UDP >#pass in quick on $int_ext inet proto udp from any to $int_ext port $UDP_IN >keep state >#PING >pass in quick on $int_ext inet proto icmp from any to $int_ext icmp-type $PING >keep state > >#OUTGOING >#EXTERNAL INTERFACE > >#TCP >pass out quick on $int_ext inet proto tcp from $int_ext to any port $TCP_OUT >flags S/SA keep >state > >#UDP >pass out quick on $int_ext inet proto udp from $int_ext to any port $UDP_OUT >keep state > >#ICMP >pass out quick on $int_ext inet proto icmp from $int_ext to any icmp-type >$PING keep state > ># Liberando acesso >pass in log on $int_int from <normal> to any keep state queue normal_in >pass in log on $int_int from <baixa> to any keep state queue baixa_in > >pass out log on $int_ext from <normal> to any keep state queue normal_on >pass out log on $int_ext from <baixa> to any keep state queue baixa_on > > >Porem acho que nao estou conseguindo fazer este controle, quando faço medição >utilizando um >velocimetro tipo esse http://www.gratis.com.br/velo/medidor.mv esta acusando >335.76 kbps apensar >que do ip esta na table de baixa (172.16.0.5) e esta designado para 256kpbs. >( Alguem tem algum >programa em freeBSD ou Windows para medir a velocidade ? ) > >Vcs podem dar uma olhada este scripts e ver o que esta errado ou então >fornecer um exemplo que eu >possa usar para controlar a banda usando o PF, caso nao seja possivel me >mandar com IPFW. > >Obrigada > >Cristina > > >__________________________________________________ >Fale com seus amigos de graça com o novo Yahoo! Messenger >http://br.messenger.yahoo.com/ >------------------------- >Histórico: http://www.fug.com.br/historico/html/freebsd/ >Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd ------------------------- Histórico: http://www.fug.com.br/historico/html/freebsd/ Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd