Nu mai stiu ce naiba faceam eu aiurea, ca sunt cam zapacit, dar pana la
urma mi-a iesit. Atasez scriptul  de mai jos ca dovada:

192.168.1.5 trage de pe ftp  cu 30kbps si de pe http cu 100kbps
192.168.1.10 trage de pe ftp cu 50kbps si de pe http cu 150kbps
Lucrul asta demonstreaza dupa parerea mea ca toate filtrele functioneaza
corect, desi numai cele cu parent in root qdisc sunt afisate

[EMAIL PROTECTED]:~# tc -s filter sh dev eth1
filter parent 1: protocol ip pref 1 fw 
filter parent 1: protocol ip pref 1 fw handle 0x2 classid 1:200 
filter parent 1: protocol ip pref 2 fw 
filter parent 1: protocol ip pref 2 fw handle 0x1 classid 1:100 



-------------

#!/bin/bash
DEV=eth1
iptables -t mangle -F
iptables -t mangle -A POSTROUTING -o $DEV -p tcp --sport 80 -j MARK \
--set-mark 0x1 
iptables -t mangle -A POSTROUTING -o $DEV -p tcp --sport 20 -j MARK \
--set-mark 0x2

CLASS="tc class add dev $DEV"
FILTER="tc filter add dev $DEV protocol ip"
QDISC="tc qdisc add dev $DEV"
IP1="192.168.1.5"
IP2="192.168.1.10"

echo "DEL OLD ROOT QDISC"
tc  qdisc del root dev $DEV >/dev/null 2>&1

echo "ADD ROOT QDISC"
$QDISC  root handle 1: htb default 12

echo -e "\tADD ROOT CLASS"
$CLASS parent 1: classid 1:1 htb rate 500kbps

echo -e "\t\tADD CLASS HTTP"
$CLASS parent 1:1 classid 1:100 htb rate 400kbps
$FILTER parent 1:0  prio 2 handle 0x1 fw flowid 1:100

echo -e "\t\t\tADD CLIENT HTTP 1"
$CLASS parent 1:100 classid 1:101 htb rate 10kbps ceil 100kbps          
$FILTER parent 1:100  prio 3 u32 match ip dst $IP1 flowid 1:101         
$QDISC parent 1:101 handle 101: sfq perturb 10

echo -e "\t\t\tADD CLIENT HTTP 2"
$CLASS parent 1:100 classid 1:102 htb rate 20kbps ceil 150kbps          
$FILTER parent 1:100  prio 3 u32 match ip dst $IP2 flowid 1:102     
$QDISC parent 1:102 handle 102: sfq perturb 10

echo -e "\t\tADD CLASS FTP"
$CLASS parent 1:1 classid 1:200 htb rate 100kbps
$FILTER  parent 1:0  prio 1 handle 0x2 fw flowid 1:200

echo -e "\t\t\tADD CLIENT FTP 1"
$CLASS parent 1:200 classid 1:201 htb rate 10kbps ceil 30kbps           
$FILTER parent 1:200  prio 3 u32 match ip dst $IP1 flowid 1:201     
$QDISC parent 1:201 handle 201: sfq perturb 10          

echo -e "\t\t\tADD CLIENT FTP 2"
$CLASS parent 1:200 classid 1:202 htb rate 10kbps ceil 50kbps           
$FILTER parent 1:200  prio 3 u32 match ip dst $IP2 flowid 1:202     
$QDISC parent 1:202 handle 202: sfq perturb 10

echo -e "\t\tADD CLASS 3 --default"
tc class add dev $DEV parent 1:1 classid 1:12 htb rate 1kbps ceil 5kbps 
$QDISC parent 1:12 handle 12: sfq perturb 10

_______________



-- 
Mihai Voica

--- 
Detalii despre listele noastre de mail: http://www.lug.ro/


Raspunde prin e-mail lui