Página 1 de 3 123 ÚltimoÚltimo
+ Responder ao Tópico



  1. Pessoal,

    é o seguinte estou com um problema no meu QoS....tenho 1mb dedicado embratel entrando no linux que roda squid + cache full(htb+tc) + apache + iptables e etc...

    meu QoS está dividindo o link de 1mb em dois de 512k ficando 512k dedicado para as portas do servidor asterisk voip e 512k dedicado para navegacao, e-mails e etc...segue abaixo os scripts:

    placa de rede interna(cache full):

    #!/bin/bash

    tc qdisc del dev eth1 root

    tc qdisc add dev eth1 root handle 1:0 htb default 40
    #----------------------alterar essa linha-------------------
    tc class add dev eth1 parent 1:0 classid 1:1 htb rate 10mbit

    tc class add dev eth1 parent 1:1 classid 1:10 htb rate 512kbit ceil 512kbit prio 1 # voip
    tc class add dev eth1 parent 1:1 classid 1:20 htb rate 100kbit ceil 200kbit prio 2 # DNS / ACK / SYN / FIN
    tc class add dev eth1 parent 1:1 classid 1:30 htb rate 250kbit ceil 512kbit prio 3 # Terminal service
    tc class add dev eth1 parent 1:1 classid 1:40 htb rate 512kbit ceil 512kbit prio 4 # HTTP
    tc class add dev eth1 parent 1:1 classid 1:60 htb rate 128kbit ceil 256kbit prio 5 # E-mail
    #--------------adiciona essa classe para receber o tr�fego do zph
    tc class add dev eth1 parent 1:1 classid 1:50 htb rate 5mbit prio 1 #ZPH


    tc qdisc add dev eth1 parent 1:10 handle 10: sfq perturb 10
    tc qdisc add dev eth1 parent 1:20 handle 20: sfq perturb 10
    tc qdisc add dev eth1 parent 1:30 handle 30: sfq perturb 10
    tc qdisc add dev eth1 parent 1:40 handle 40: sfq perturb 10
    tc qdisc add dev eth1 parent 1:50 handle 50: sfq perturb 10
    tc qdisc add dev eth1 parent 1:60 handle 60: sfq perturb 10

    tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip sport 5060 0xffff flowid 1:10
    tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip sport 5061 0xffff flowid 1:10
    tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip sport 10000 0xffff flowid 1:10
    tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip sport 20000 0xffff flowid 1:10
    tc filter add dev eth1 parent 1:0 protocol ip prio 2 u32 match ip sport 53 0xffff flowid 1:20
    tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip sport 3389 0xffff flowid 1:30
    tc filter add dev eth1 parent 1:0 protocol ip prio 4 u32 match ip sport 80 0xffff flowid 1:40
    tc filter add dev eth1 parent 1:0 protocol ip prio 5 u32 match ip sport 25 0xfff flowid 1:60
    tc filter add dev eth1 parent 1:0 protocol ip prio 5 u32 match ip sport 110 0xfff flowid 1:60
    #-------------e finalmente o filtro que vai classificar o tr�fego e jogar na classe certa
    tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip protocol 0x6 0xff match ip tos 0x60 0xff flowid 1:50


    Placa de rede externa:

    !/bin/bash

    tc qdisc del dev eth0 root

    tc qdisc add dev eth0 root handle 1:0 htb default 40
    tc class add dev eth0 parent 1:0 classid 1:1 htb rate 1024kbit

    tc class add dev eth0 parent 1:1 classid 1:10 htb rate 512kbit ceil 512kbit prio 1 # voip
    tc class add dev eth0 parent 1:1 classid 1:20 htb rate 100kbit ceil 200kbit prio 2 # DNS / ACK / SYN / FIN
    tc class add dev eth0 parent 1:1 classid 1:30 htb rate 64kbit ceil 64kbit prio 3 # Terminal service
    tc class add dev eth0 parent 1:1 classid 1:40 htb rate 512kbit ceil 512kbit prio 4 # HTTP
    tc class add dev eth0 parent 1:1 classid 1:50 htb rate 128kbit ceil 256kbit prio 5 # E-mail


    tc qdisc add dev eth0 parent 1:10 handle 10: pfifo limit 10
    tc qdisc add dev eth0 parent 1:20 handle 20: sfq perturb 10
    tc qdisc add dev eth0 parent 1:30 handle 30: sfq perturb 10
    tc qdisc add dev eth0 parent 1:40 handle 40: sfq perturb 10
    tc qdisc add dev eth0 parent 1:50 handle 50: sfq perturb 10


    tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip dport 5060 0xffff flowid 1:10
    tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip dport 5061 0xffff flowid 1:10
    tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip dport 10000 0xffff flowid 1:10
    tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip dport 20000 0xffff flowid 1:10
    tc filter add dev eth0 parent 1:0 protocol ip prio 2 u32 match ip dport 53 0xffff flowid 1:20
    tc filter add dev eth0 parent 1:0 protocol ip prio 3 u32 match ip dport 3389 0xffff flowid 1:30
    tc filter add dev eth0 parent 1:0 protocol ip prio 4 u32 match ip dport 80 0xffff flowid 1:40
    tc filter add dev eth0 parent 1:0 protocol ip prio 5 u32 match ip dport 25 0xfff flowid 1:50
    tc filter add dev eth0 parent 1:0 protocol ip prio 5 u32 match ip dport 110 0xfff flowid 1:50


    mas nos testes o QoS do voip não está funcionando...o cache full funciona mas o QoS para o voip ficar com 512k não está funcionando como podem ver nos testes abaixo:


    teste na placa de rede interna:

    proxy:/home/novaf# tc -s -d class show dev eth1
    class htb 1:1 root rate 10000Kbit ceil 10000Kbit burst 6598b/8 mpu 0b overhead 0b cburst 6598b/8 mpu 0b overhead 0b level 7
    Sent 139281689 bytes 190179 pkt (dropped 0, overlimits 0 requeues 0)
    rate 518248bit 98pps backlog 0b 0p requeues 0
    lended: 2071 borrowed: 0 giants: 0
    tokens: 2774 ctokens: 2774

    class htb 1:10 parent 1:1 leaf 10: prio 1 quantum 6400 rate 512000bit ceil 512000bit burst 1855b/8 mpu 0b overhead 0b cburst 1855b/8 mpu 0b overhead 0b level 0
    Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) ==> está zerado o sent
    rate 0bit 0pps backlog 0b 0p requeues 0
    lended: 0 borrowed: 0 giants: 0
    tokens: 29696 ctokens: 29696

    class htb 1:20 parent 1:1 leaf 20: prio 2 quantum 1250 rate 100000bit ceil 200000bit burst 1649b/8 mpu 0b overhead 0b cburst 1699b/8 mpu 0b overhead 0b level 0
    Sent 42805 bytes 223 pkt (dropped 0, overlimits 0 requeues 0)
    rate 472bit 0pps backlog 0b 0p requeues 0
    lended: 223 borrowed: 0 giants: 0
    tokens: 127304 ctokens: 65700

    class htb 1:30 parent 1:1 leaf 30: prio 3 quantum 3125 rate 250000bit ceil 512000bit burst 1724b/8 mpu 0b overhead 0b cburst 1855b/8 mpu 0b overhead 0b level 0
    Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
    rate 0bit 0pps backlog 0b 0p requeues 0
    lended: 0 borrowed: 0 giants: 0
    tokens: 56524 ctokens: 29696

    class htb 1:40 parent 1:1 leaf 40: prio 4 quantum 6400 rate 512000bit ceil 512000bit burst 1855b/8 mpu 0b overhead 0b cburst 1855b/8 mpu 0b overhead 0b level 0
    Sent 132575793 bytes 166721 pkt (dropped 0, overlimits 0 requeues 0)
    rate 509360bit 78pps backlog 0b 15p requeues 0
    lended: 166706 borrowed: 0 giants: 0
    tokens: -47518 ctokens: -47518

    class htb 1:50 parent 1:1 leaf 50: prio 1 quantum 62500 rate 5000Kbit ceil 5000Kbit burst 4Kb/8 mpu 0b overhead 0b cburst 4Kb/8 mpu 0b overhead 0b level 0
    Sent 108045 bytes 312 pkt (dropped 0, overlimits 0 requeues 0)
    rate 112bit 0pps backlog 0b 0p requeues 0
    lended: 312 borrowed: 0 giants: 0
    tokens: 6626 ctokens: 6626

    class htb 1:60 parent 1:1 leaf 60: prio 5 quantum 1600 rate 128000bit ceil 256000bit burst 1663b/8 mpu 0b overhead 0b cburst 1727b/8 mpu 0b overhead 0b level 0
    Sent 6572310 bytes 22938 pkt (dropped 0, overlimits 0 requeues 0)
    rate 8928bit 15pps backlog 0b 0p requeues 0
    lended: 20867 borrowed: 2071 giants: 0
    tokens: 102912 ctokens: 53504




    teste placa de rede externa:

    proxy:/home/novaf# tc -s -d class show dev eth0
    class htb 1:1 root rate 1024Kbit ceil 1024Kbit burst 2111b/8 mpu 0b overhead 0b cburst 2111b/8 mpu 0b overhead 0b level 7
    Sent 34052274 bytes 60356 pkt (dropped 0, overlimits 0 requeues 0)
    rate 264592bit 41pps backlog 0b 0p requeues 0
    lended: 11888 borrowed: 0 giants: 0
    tokens: 14850 ctokens: 14850

    class htb 1:10 parent 1:1 leaf 10: prio 1 quantum 6400 rate 512000bit ceil 512000bit burst 1855b/8 mpu 0b overhead 0b cburst 1855b/8 mpu 0b overhead 0b level 0
    Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) ====>mesma coisa zerada
    rate 0bit 0pps backlog 0b 0p requeues 0
    lended: 0 borrowed: 0 giants: 0
    tokens: 29696 ctokens: 29696

    class htb 1:20 parent 1:1 leaf 20: prio 2 quantum 1250 rate 100000bit ceil 200000bit burst 1649b/8 mpu 0b overhead 0b cburst 1699b/8 mpu 0b overhead 0b level 0
    Sent 22283 bytes 267 pkt (dropped 0, overlimits 0 requeues 0)
    rate 176bit 0pps backlog 0b 0p requeues 0
    lended: 267 borrowed: 0 giants: 0
    tokens: 121407 ctokens: 62752

    class htb 1:30 parent 1:1 leaf 30: prio 3 quantum 1000 rate 64000bit ceil 64000bit burst 1631b/8 mpu 0b overhead 0b cburst 1631b/8 mpu 0b overhead 0b level 0
    Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
    rate 0bit 0pps backlog 0b 0p requeues 0
    lended: 0 borrowed: 0 giants: 0
    tokens: 208896 ctokens: 208896

    class htb 1:40 parent 1:1 leaf 40: prio 4 quantum 6400 rate 512000bit ceil 512000bit burst 1855b/8 mpu 0b overhead 0b cburst 1855b/8 mpu 0b overhead 0b level 0
    Sent 3735641 bytes 32562 pkt (dropped 0, overlimits 0 requeues 0)
    rate 23424bit 18pps backlog 0b 0p requeues 0
    lended: 32562 borrowed: 0 giants: 0
    tokens: 25602 ctokens: 25602

    class htb 1:50 parent 1:1 leaf 50: prio 5 quantum 1600 rate 128000bit ceil 256000bit burst 1663b/8 mpu 0b overhead 0b cburst 1727b/8 mpu 0b overhead 0b level 0
    Sent 30317154 bytes 27543 pkt (dropped 0, overlimits 0 requeues 0)
    rate 244616bit 22pps backlog 0b 16p requeues 0
    lended: 15639 borrowed: 11888 giants: 0
    tokens: -103420 ctokens: -95988

    alguém tem idéia do que pode ser o problema? o que está errado no script?

  2. procure fazer com marcação de pacotes via iptables


    IFNET=eth0
    IFLOCAL=eth1
    CONT=100
    MARK=101

    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    IPTABLES="/sbin/iptables"


    # ADICIONANDO CLASSES PRINCIPAIS PARA CADA IP
    tc class add dev $IFLOCAL parent 1:1 classid 1:$CONT htb rate "$DOWN"kbit ceil "$MAXDOWN"kbit prio 3
    tc class add dev $IFNET parent 1:1 classid 1:$CONT htb rate "$UP"kbit ceil "$UP"kbit prio 3

    # ADICIONANDO CLASSES COM MAIOR PRIORIDADE CADA IP
    tc class add dev $IFLOCAL parent 1:$CONT classid 1:$MARK htb rate "$(($DOWN * 800))"bit ceil "$MAXDOWN"kbit prio 3
    tc class add dev $IFNET parent 1:$CONT classid 1:$MARK htb rate "$(($UP * 800))"bit ceil "$UP"kbit prio 3

    tc qdisc add dev $IFLOCAL parent 1:$MARK handle "$MARK": sfq perturb 9
    tc qdisc add dev $IFNET parent 1:$MARK handle "$MARK": sfq perturb 9

    tc filter add dev $IFLOCAL parent 1:0 protocol ip prio 10 handle $MARK fw classid 1:$MARK
    tc filter add dev $IFNET parent 1:0 protocol ip prio 10 handle $MARK fw classid 1:$MARK

    $IPTABLES -t mangle -A POSTROUTING -s $IP -p tcp -m multiport --ports 80,3128,443,22,25,53 -j MARK --set-mark $MARK # Seta portas com maior prioridade down
    $IPTABLES -t mangle -A POSTROUTING -d $IP -p tcp -m multiport --ports 80,3128,443,22,25,53 -j MARK --set-mark $MARK # Seta portas com maior prioridade up

    MARK=$(($MARK + 1))



  3. Faça um teste redurindo a velocidade da rede interna de 10mbit para 1mbit.

  4. normalmente voip utiliza-se de intervalo de portas portanto marcação de pacotes é necessário



  5. Olá pessoal. Tenho percebido que quando coloco o squid + htb, o controle de banda se perde.
    Alguem pode me ajudar?
    Obrigado






Tópicos Similares

  1. Respostas: 12
    Último Post: 09-03-2015, 14:24
  2. Controle de banda não funciona completamente Htb+tc
    Por lfernandosg no fórum Servidores de Rede
    Respostas: 1
    Último Post: 07-10-2010, 07:45
  3. Versção 3.28 Não Está controlando Banda
    Por LulaVipNET no fórum Redes
    Respostas: 2
    Último Post: 17-03-2010, 14:58
  4. um cliente nao esta controlando o up
    Por wesleymyau no fórum Redes
    Respostas: 2
    Último Post: 19-12-2008, 07:23
  5. HTB não está funcionando limtação para a maquina
    Por slacklex no fórum Servidores de Rede
    Respostas: 2
    Último Post: 21-04-2006, 12:47

Visite: BR-Linux ·  VivaOLinux ·  Dicas-L