Hi!
I have to manage the bandwitdh of a cable operator
and share it.
They have a total bandwidth of 4Mb and 250
customers connected on this network.
They divided their bandwith in 3
category:
64kb => subnet 172.16.64.X
128k => subnet 172.16.128.X
256k => subnet 172.16.254.X
So I have to limit the bandwith of eith
user:
64Kb for a user in the subnet
172.16.64.X
....
After reading the LARC HOWTO, i tried to
make a script for sharing the bandwith.
The example 12.4 (Hashing filters for very fast
massive filtering) correspond exactly to my problem but i'm not able to implement it,
my script doesn't work, the bandwitdh is not
share.:((
Can anyone can help me and tell me what is wrong in
my script below?
The only difference i see between my script and the
example in the howto is:
- In my script i define the rules for ip
dst
-In the howto they define the rules for ip
src
Thank you very much for your help
The script:
tc qdisc del dev eth1 root
tc qdisc add dev eth1 root handle 1:0 cbq bandwidth
4Mbit avpkt 1000 cell 8
tc class add dev eth1 parent 1:0 classid 1:1 cbq bandwidth 64kbit \ rate 64kbit prio 5 allot 1514 weight 6kbit cell 8 maxburst 20 \ avpkt 1000 isolated tc class add dev eth1 parent 1:0 classid 1:2 cbq bandwidth 128kbit
\
rate 128kbit prio 5 allot 1514 weight 12kbit cell 8 maxburst 20 \ avpkt 1000 isolated tc class add dev eth1 parent 1:0 classid 1:3 cbq bandwidth 256kbit
\
rate 256kbit prio 5 allot 1514 weight 25kbit cell 8 maxburst 20 \ avpkt 1000 isolated tc filter add dev eth1 parent 1:0 prio 5 protocol ip u32
tc filter add dev eth1 parent 1:0 prio 5 handle 2: u32 divisor 256 j=0;
while [ $j -le 255 ]; do hex=`echo "obase=16; $j" |bc` tc filter add dev eth1 protocol ip parent 1:0 prio 5 u32 ht 2:$hex: \ match ip dst 172.16.64.$j flowid 1:1 tc filter add dev eth1 protocol ip parent 1:0 prio 5 u32 ht 2:$hex: \ match ip dst 172.16.128.$j flowid 1:2 tc filter add dev eth1 protocol ip parent 1:0 prio 5 u32 ht 2:$hex: \ match ip dst 172.16.254.$j flowid 1:3 j=$((j+1)) done tc filter add dev eth1 protocol ip parent 1:2 prio 5 u32 ht 800::
\
match ip dst 172.16.0.0/16 \ hashkey mask 0x000000ff at 12 \ link 2: Michael Richez.
|