LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   CBQ question for gurus (http://www.linuxquestions.org/questions/linux-networking-3/cbq-question-for-gurus-513429/)

ALInux 12-24-2006 02:17 PM

CBQ question for gurus
 
Hi I have been trying to limit the traffic of each of the 10 hosts on my LAN to 10kbyte/s for the download of each host I have tried the following two approaches with the same result (The bandwidth for the whole network is limitied to 10kbyte/s instead of a per host basis)

Ive tried cbq.init using the following config file :

DEVICE=eth1,100Mbit,10Mbit
RATE=100Kbit
WEIGHT=10Kbit
PRIO=5
RULE=192.168.15.0/24

And Ive read LARTC and Ive setup my own configuration with the same result as above, the question "posted to the lartc mailing list" is stated below :

Hi Ive been reading, testing and applying what Iam reading in the
LARTC tutorial for a couple of days, I do not wish to use ready made
scripts because that means I will always come back and ask the same
question again.

So Ive been wondering if I have 10 computers and I do want to limit
the download for each of those 10 computers to 10 kbyte per second. I
would create a leaf class and match the traffic that comes from those
networks using either (below are only example cases to explain my
point) :

# tc filter add dev eth0 parent 10:0 protocol ip prio 1 u32 \
match ip src 1.2.3.4/32 flowid 10:1

OR

# tc filter add dev eth1 protocol ip parent 1:0 prio 1 handle 6 fw flowid 1:1
# iptables -A PREROUTING -t mangle -s 1.2.3.4/32 -j MARK --set-mark 6

And let's suppose I created my classes like this diagram :

root 1:
|
_1:1_
/
/
/
10:
/
10:1

If I have the hierachy displayed above, and that the leaf class 10:1
is the class that limits the download rate to my requested 10 kbyte
per second. Using either of the matches above will redirect all
matched packets through the filter of the matching class. But in this
case cumulative bandwidth of the traffic computers on the matching
network will be limited to 10kbyte.

What do I have to do so that the traffic of each host on the network
will get a download limit of 10 kbyte per second.

Do I have to create classes 10:n where n is the number of hosts, or do
I have to change my matching pattern. Or can I create a class that
will match the traffic of each host in the network individually ?

Below is my current setup :

tc qdisc add dev eth2 root handle 11: cbq bandwidth 100Mbit avpkt \
1000 mpu 64
tc class add dev eth2 parent 11:0 classid 11:1 cbq rate 100Kbit \
weight 10Kbit allot 1514 prio 1 avpkt 1000 bounded
tc filter add dev eth2 parent 11:0 protocol ip handle 4 fw flowid 11:1

iptables -t mangle -A POSTROUTING -s ! 192.168.128.16/28 -d \
192.168.128.16/28 -j MARK --set-mark 4


All times are GMT -5. The time now is 09:55 PM.