Matheus, Uma dúvida, que ainda não me ficou clara até hoje.
Como você mesmo falou, eu posso criar no ipfw um pipe de 1MB para SSH e 30MB para web, mesmo que o link seja de 5MB. Não tem que ter nada próximo com a realidade, a não ser que você vá colocar pesos. No PF isto não é válido, eu tenho que criar uma classe com meu link total e ir divindo de forma que a soma não ultrapsse o total. Tem alguma outra maneira de fazer isto? Por exemplo, se você é um ISP e tem 100 usuários comprando 500K, não indica necessariamente que você tem um link de 5MB. E por aí vai. Ou outro exemplo, se eu tenho o PF em meu gateway e eu tenho a DMZ e quero limitar um PC a fazer downloads a 100K na internet, mas não limitar a DMZ, no PF eu teria que criar uma declaração para a DMZ, presumindo que o link seja a 100MB, outra para a internet e por ai vai. No ipfw eu faria um 'pipe X all from $pc_interno to $dmz out via XXXX' e por ai vai. > -----Mensagem original----- > De: freebsd-boun...@fug.com.br [mailto:freebsd-boun...@fug.com.br] Em > nome de Nenhum_de_Nos > Enviada em: segunda-feira, 1 de junho de 2009 22:34 > Para: freebsd@fug.com.br > Assunto: Re: [FUG-BR] (não sei se é off) Priorização de tráfego para > dois hosts em PFSENSE > > On Mon, 1 Jun 2009 21:50:27 -0300 > Wanderson Tinti <wander...@bsd.com.br> wrote: > > > 2009/6/1 Nenhum_de_Nos <math...@eternamente.info>: > > > On Mon, 1 Jun 2009 13:37:41 -0300 > > > Mateus Menezes <mat...@gmail.com> wrote: > > > > > >> -----BEGIN PGP SIGNED MESSAGE----- > > >> Hash: SHA1 > > >> > > >> Bom dia, > > >> > > >> > > >> Estou com o seguinte cenário: > > >> > > >> Tenho uma rede com um pfsense funcionando como gateway de internet > > >> (compartilhando a conexão e firewall). > > >> Preciso fazer que quando (e somente quando) duas máquinas > específicas > > >> entrarem na rede, estas terão prioridade de tráfego (alocar 50% da > banda pra > > >> elas). > > > > > > hfsc nao resolve ? > > > > > > tu diz que a fila tem 50% e realtime tb 50% > > > > > > se elas nao usarem, as demais podem usar. se nao quiser isso, > coloca que o resto tem upperlimit dos outros 50% > > > > > > matheus > > > > > antes de mais nada digo que não sou expert nisso, só fiz até onde > precisava por aqui, com muita pesquisa e dor de cabeça. mas no que > puder ajuda, tranquilo. > > > Rapaz andei fazendo uns testes com hfsc e fiquei de cabelo em pé. Não > > entendi essas três opções (realtime, upperlimit e linkshare), quando > > é meio louco isso mesmo. AFAIK, realtime e linkshare são quase a mesma > coisa. uso o primeiro. são usados quando o link tá saturado, para > garantir à esta fila a banda que você quer. o link satura para ele qd > usa 85% do definido (a soma de realtime dó pode dar isso, ou é 80%) > > > tudo parecia caminhar ai que eu menos entendia o que estava > > acontecendo. Larguei de lado e usei pf + dummynet. Na verdade queria > > mas o dummynet + ipfw é muito massa, pois em pf não posso limitar o > mundo por ex à 100kbps. a soma sempre tem que ser <= banda declarada. > > > usar openbsd com pf e hfsc, não teve jeito pulei para freeba. > > o OpenBSD é massa. seguro e carrancudo. mas ainda prefiro o FreeBSD. só > não uso pq no meu hardware o FreeBSD não acha meu disco microdrive da > seagate com minha controladora ata. o OpenBSD usa sem problemas. > > mas prefiro a facilidade de atualização do FreeBSD. e o 8-CURRENT tá > sem noção de massa :) > > > Nenhum_de_nos por acaso você tem algo para compartilhar sobre o > > funcionamento do hfsc, alguma regra, exemplo para que possa testar > > trocar algumas figurinhas? > > tranquilo. o que eu souber. > > deixe-me colocar o que está aqui. é um FW simples, ainda preciso ler > sobre muita coisa. mas controla meu dsl ok. :) > > tenho pcs em casa, onde posso dividir em duas classes, meu pc que roda > ed2k e fold...@home, e demais. não preciso controlar ninguém aqui (não > há usuários escrotos), mas quero que o fah (folding) quando mande seus > WU's não atole meu upload, mas tenha o max de banda para mandar logo. > quero o max de upload para meu ed2k, sem tb atolar a rede. qd o fah > tiver mandando, o ed2k perde banda pq fah não fica 24h como o ed2k. > > pfTop: Up Queue 1-21/21, View: queue, Cache: 10000 > 22:21:53 > > QUEUE BW SCH PR PKTS BYTES DROP_P DROP_B QLEN BORR SUSP > P/S B/S > root_tun0 300K hfsc 0 0 0 0 0 0 > 0 0 > out_ack 30000 hfsc 8 299 23780 0 0 0 > 0 0 > out_dns 15000 hfsc 7 23923 2149K 269 18885 0 > 1 114 > out_ssh 30000 hfsc 6 9166 3281K 0 0 0 > 0.2 11 > out_jogos 45000 hfsc 5 1269 103K 0 0 0 > 0 0 > out_web 30000 hfsc 4 1621K 144M 236 31680 0 > 7 2600 > out_smtp 15000 hfsc 3 7266 784K 0 0 0 > 0 0 > out_bolo 15000 hfsc 2 735K 45M 0 0 0 > 12 738 > out_p2pFah 15000 hfsc 0 0 0 0 0 > 0 0 > out_fah 12000 hfsc 7 99768 126M 130 192920 0 > 0 0 > out_p2p 3000 hfsc 2 6188K 2300M 986184 279M 49 > 63 20K > root_vr0 100M hfsc 0 0 0 0 0 0 > 0 0 > in_inet 1000K hfsc 8 0 0 0 0 0 > 0 0 > in_dns 10000 hfsc 8 0 0 0 0 0 > 0 0 > in_ssh 100K hfsc 7 2217 246K 0 0 0 > 0.2 35 > in_jogos 150K hfsc 6 0 0 0 0 0 > 0 0 > in_web 300K hfsc 5 1849K 2579M 0 0 0 > 2 2198 > in_p2pFah 100K hfsc 0 0 0 0 0 > 0 0 > in_fah 80000 hfsc 7 59317 22M 0 0 0 > 0 0 > in_p2p 20000 hfsc 2 7384K 4013M 1312 407082 0 > 96 61K > lan 99M hfsc 26641 11M 0 0 0 > 1 453 > > tem mais algumas classes que quero dar prioridade. a que mais apanho é > mandar ACK's logo. falta estudar isso :) > > as regras para isso são: > > # cat regras.pf > ext_if="tun0" > modem_if="fxp0" > int_if="vr0" > lan="10.1.1.0/24" > > # Maquinas > > p = "10.1.1.1" > m = "10.1.1.2" > lamneth = "10.1.1.10" > mo = "10.1.1.12" > arroway = "10.1.1.80" > darkside = "10.1.1.100" > > portas_arroway = "5910" > portas_p2p = "{ 5000:5100 5900 }" > portas_m = "5000:5100" > portas_jogos = "{ 2009 2106 7777 }" > portas_servicos = "22 25 80 443" > portas_ssh = "{ 22 443 }" > > scrub in > set skip on lo0 > > altq on $ext_if hfsc bandwidth 300Kb queue { out_ack, out_dns, out_ssh, > out_web, out_jogos, out_p2pFah, out_smtp, out_bolo } > queue out_ack bandwidth 10% priority 8 hfsc (realtime 20%) > queue out_dns bandwidth 5% priority 7 hfsc (realtime 5%) > queue out_ssh bandwidth 10% priority 6 hfsc (realtime 10%) > queue out_jogos bandwidth 15% priority 5 hfsc (realtime 15%) > queue out_web bandwidth 10% priority 4 hfsc (realtime 10%) > queue out_smtp bandwidth 5% priority 3 hfsc (realtime 15%) > queue out_bolo bandwidth 5% priority 2 hfsc (default) > queue out_p2pFah bandwidth 5% priority 1 hfsc (upperlimit > 160Kb) { out_fah, out_p2p } > queue out_fah bandwidth 80% priority 7 hfsc > queue out_p2p bandwidth 20% priority 2 hfsc > > altq on $int_if hfsc bandwidth 100Mb queue {in_inet, lan } > queue in_inet bandwidth 1% priority 8 hfsc (realtime 1%) { > in_dns, in_ssh, in_jogos, in_web, in_p2pFah } > queue in_dns bandwidth 5% priority 8 hfsc (realtime 5%) > queue in_ssh bandwidth 10% priority 7 hfsc (realtime 10%) > queue in_jogos bandwidth 15% priority 6 hfsc (realtime 15%) > queue in_web bandwidth 30% priority 5 hfsc (realtime 10%) > queue in_p2pFah bandwidth 10% priority 1 hfsc (upperlimit > 80%) { in_fah, in_p2p } > queue in_fah bandwidth 80% priority 7 hfsc > queue in_p2p bandwidth 20% priority 2 hfsc (default) > queue lan bandwidth 99% priority 1 hfsc (upperlimit > 98%) > > table <chatos_ssh> persist > table <ips_fah> persist file "/root/ips_fah" > > nat on $ext_if from $lan to any -> ($ext_if) > nat on $modem_if from $lan to any -> ($modem_if) > > # m > rdr on $ext_if proto { tcp, udp } from any to any port $portas_m tag > in_p2p -> $m > > # lamneth > #rdr pass inet proto tcp from !<spamd-white> to > any port smtp -> 127.0.0.1 port spamd > #rdr pass inet proto tcp from <spamd> to any port smtp -> 127.0.0.1 > port spamd > rdr on $ext_if proto tcp from any to any port 80 tag > in_web -> $lamneth > rdr on $ext_if proto tcp from any to any port 443 tag > in_ssh -> $lamneth port 22 > > # arroway > rdr on $ext_if proto tcp from any to any port 2222 tag > in_ssh -> $arroway port 22 > rdr on $ext_if proto tcp from any to any port 10101 tag > in_web -> $arroway > rdr on $ext_if proto { tcp, udp } from any to any port > $portas_arroway tag in_p2p -> $arroway > > # Servicos > #rdr on $ext_if proto tcp from any to any port 25 > -> $lamneth > rdr on $ext_if proto tcp from any to any port 25 tag > in_email -> 127.0.0.1 > > # RDP > rdr on $ext_if proto { tcp, udp } from any to any port 3389 tag > in_rdp -> $mainha > > # Geral > > block log quick from <chatos_ssh> > block in on $ext_if all > block in on $int_if all > antispoof for $ext_if > > # DSL in > pass in log on $ext_if tagged in_ssh keep state (max-src-conn-rate 4/60 > overload <chatos_ssh> flush global) queue (out_bolo, out_ssh) > pass in on $ext_if tagged in_email modulate state queue (out_bolo, > out_smtp) > pass in on $ext_if tagged in_p2p keep state queue (out_p2p) > pass in on $ext_if tagged in_ssh keep state queue (out_bolo, out_ssh) > pass in on $ext_if tagged in_web keep state queue (out_bolo, out_web) > pass in on $ext_if inet proto tcp from any to any port 22 > modulate state queue (out_bolo, out_ssh) > > # DSL out > pass out quick on $ext_if proto tcp from any to any flags A/A > keep state queue (out_ack) > pass out on $ext_if inet proto { tcp, udp } from any to any port 53 > keep state queue (out_dns) > pass out on $ext_if proto tcp from any to any port { 22, > 2222, 23456 } keep state queue (out_ssh) > pass out on $ext_if proto tcp from any to any port { 21, 80, > 443, 8080 } keep state queue (out_web) > pass out on $ext_if proto tcp from any to any port { 80, 443, > 8080 } modulate state queue (out_web) > pass out quick on $ext_if from any to <ips_fah> > keep state queue (out_fah) > pass in on $ext_if proto tcp from $arroway port 5900 to any > modulate state queue (out_p2p) > pass in on $ext_if proto udp from $arroway port 5900 to any > keep state queue (out_p2p) > pass out on $ext_if proto { tcp, udp } from any to any port ntp > keep state queue (out_ack) > pass out on $ext_if proto tcp from any to any port { 25, 465, > 587 } keep state queue (out_smtp) > pass out on $ext_if proto { tcp, udp } from any to any port 7777 > keep state queue (out_jogos) > pass out on $ext_if proto tcp from any to any port 1683 > keep state queue (out_bolo) > > # LAN in > > pass in on $int_if from $arroway to any > keep state queue (out_p2p, in_p2p) > pass in on $int_if proto tcp from any to any port 1683 > keep state queue (in_bolo) > pass in on $int_if proto tcp from $arroway port 5900 to any > modulate state queue (in_p2p) > pass in on $int_if proto udp from $arroway port 5900 to any > keep state queue (in_p2p) > pass in on $int_if proto tcp from any to any port { 22, > 2222, 23456 } keep state queue (in_ssh) > pass in on $int_if proto { tcp, udp } from $lamneth to any port 53 > keep state > pass in on $int_if proto tcp from any to any port { 80, 443, > 8080 } modulate state queue (in_web, out_web) > pass in on $int_if proto tcp from any to any port { 25, 465, > 587 } modulate state queue (out_smtp) > pass in on $int_if proto { tcp, udp } from any to any port ntp > keep state > pass in on $int_if from $arroway to <ips_fah> > keep state queue (in_fah) > pass in on $int_if from $int_if:network to $int_if > keep state queue (lan) > > # LAN out > pass out on $int_if from any to any > keep state > pass out on $int_if from $int_if to $int_if:network > keep state queue (lan) > > tem coisa para melhorar (sempre), mas cada pedaço de tempo arrumo uma > coisa. aqui, o amule fica sempre colado nos 20k. se o fah vai mandar, > ele manda na casa dos 16k e o amule cai para 4k. ainda apanho um pouco > com outros protocolos (nem tudo funciona 100%, mas não sei se é culpa > minha, do hfsc ou protocolo). já fiz teste e tem fluxo que não toma > toda a banda alocada para ele, aí novamente não sei se é culpa do hfsc > ou protocolo ou minha. neste caso que tem dois ip's para reservar > banda, tenho tido exp boa aqui em limites, seja com PRIQ ou HFSC. > > espero que tenha ajudado mais que complicado, qquer coisa é só falar :) > > uma fonte que usei (muito) para ter info sobre pf+hfsc foi o site do > calomel https://calomel.org/ e o livro do Jacek Artymiak de pf e > openbsd. e muita tentativa :) > > matheus > > > Boa noite moçada. > > ------------------------- > > Histórico: http://www.fug.com.br/historico/html/freebsd/ > > Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd > > > -- > We will call you cygnus, > The God of balance you shall be > > A: Because it messes up the order in which people normally read text. > Q: Why is top-posting such a bad thing? > > http://en.wikipedia.org/wiki/Posting_style > ------------------------- > 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