How

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




--
With Regards Ali Jawad
_______________________________________________
LARTC mailing list
LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux