Nataniel Klug
2006-Apr-05 12:03 UTC
Configuration of my QoS ruleset (now working fine with u32 classifier)
Hello all, As I have promised I am sending my QoS rules. This now works fine with u32 classifier (and parent 1:0 that I could not understand why it did not worked well before). Att, Nataniel Klug ------------------------ #!/bin/sh #------ # Script de QoS Cyber Nett #------ # Nataniel Klug # suporte@cnett.com.br #------ TC="/sbin/tc" IPT="/usr/local/sbin/iptables" DL="eth1" #------ # Apagando regras antigas de QoS #------ $TC qdisc del dev $DL root 2> /dev/null > /dev/null $TC qdisc del dev $DL ingress 2> /dev/null > /dev/null #------ # Regras para a placa eth1 #------ $TC qdisc add dev $DL root handle 1: htb default 40 CLASS="/sbin/tc class add dev $DL parent" $CLASS 1: classid 1:1 htb rate 3096Kbit $CLASS 1:1 classid 1:10 htb rate 2048Kbit ceil 3096Kbit $CLASS 1:1 classid 1:20 htb rate 1024Kbit ceil 3096Kbit $CLASS 1:1 classid 1:30 htb rate 1024Kbit ceil 2048Kbit $CLASS 1:1 classid 1:40 htb rate 512Kbit ceil 2048Kbit QDISC="/sbin/tc qdisc add dev $DL parent" $QDISC 1:10 handle 10: sfq perturb 10 $QDISC 1:20 handle 20: sfq perturb 10 $QDISC 1:30 handle 30: sfq perturb 10 $QDISC 1:40 handle 40: sfq perturb 10 FILTER="/sbin/tc filter add dev $DL parent 1:0 protocol ip prio 1 u32" #---- # Regras com maior prioridade # APENAS NAVEGACAO E PING #---- $FILTER match ip sport 80 0xffff flowid 1:10 $FILTER match ip sport 443 0xffff flowid 1:10 $FILTER match ip sport 3128 0xffff flowid 1:10 $FILTER match ip protocol 1 0xff flowid 1:10 #---- # Regra especial para o conteudo # ns2.cnett.com.br #---- $FILTER match ip src 200.163.208.4/32 flowid 1:10 $FILTER match ip src 200.163.208.5/32 flowid 1:10 #---- # Regras com prioridade mediana # DNS, SSH, Telnet #---- $FILTER match ip sport 22 0xffff flowid 1:20 $FILTER match ip sport 23 0xffff flowid 1:20 $FILTER match ip sport 53 0xffff flowid 1:20 $FILTER match ip sport 2202 0xffff flowid 1:20 #---- # Regras com prioridade baixa # Mail #---- $FILTER match ip sport 25 0xffff flowid 1:30 $FILTER match ip sport 110 0xffff flowid 1:30