[MASOCH-L] Limite de tráfego
    Murilo Opsfelder Araújo 
    mopsfelder at gmail.com
       
    Mon Sep 29 16:58:30 -03 2008
    
    
  
Ola' pessoal,
estou com duvidas para fazer limite de trafego da LAN para Internet
(upload) e da Internet para LAN (download).
Atualmente, o limite de trafego esta' sendo realizado da seguinte forma:
1.  Existe uma regra de firewall iptables que cria uma chain chamada "limite"
    que recebe todos os pacotes de encaminhamento (FORWARD).
    Regra:
    /sbin/iptables -t mangle -N limite
    /sbin/iptables -t mangle -A FORWARD -j limite
2.  Para limitar o download em 100 kbits/s e o upload em 50 kbits/s da estacao
    10.10.5.2, por exemplo, sao adicionadas regras na tabela mangle do firewall
    iptables, ficando assim:
    # iptables -t mangle -vnL
    Chain limite (1 references)
    pkts bytes  target     prot opt in     out     source
 destination
    0    0      MARK       0    --  *      *       0.0.0.0/0
 10.10.5.2           MARK set 0x1
    0    0      MARK       0    --  *      *       10.10.5.2
 0.0.0.0/0           MARK set 0x1
3.  Depois, e' utilizado o tc para gerenciar as classes de enfileiramento,
    ficando assim:
    Interface de LAN (eth0)
    # tc qdisc show dev eth0
    qdisc htb 10: r2q 1 default 10 direct_packets_stat 106
    # tc class show dev eth0
    class htb 10:1 root prio 0 rate 100000bit ceil 100000bit burst
1724b cburst 1724b
    # tc filter show dev eth0
    filter parent 10: protocol ip pref 1 fw
    filter parent 10: protocol ip pref 1 fw handle 0x1 classid 10:1
    Interface de LINK (eth1)
    # tc qdisc show dev eth1
    qdisc htb 20: r2q 1 default 10 direct_packets_stat 3
    # tc class show dev eth1
    class htb 20:1 root prio 0 rate 100000bit ceil 100000bit burst
1724b cburst 1724b
    # tc filter show dev eth1
    filter parent 20: protocol ip pref 1 fw
    filter parent 20: protocol ip pref 1 fw handle 0x1 classid 20:1
Deve haver algum ponto que estou falhando, pois o limite nao funciona
como o esperado.
Gostaria da ajuda de voces pra me dizer o caminho das pedras.
Informacoes sobre o ambiente:
Linux 2.4.35
iproute 2.6.22
iptables 1.3.6
Obrigado,
Murilo.
    
    
More information about the masoch-l
mailing list