This is a multi-part message in MIME format. ------=_NextPart_000_003D_01C2F774.E42EE220 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 =3D> subnet 172.16.64.X 128k =3D> subnet 172.16.128.X 256k =3D> 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=3D0; while [ $j -le 255 ]; do hex=3D`echo "obase=3D16; $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=3D$((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. ------=_NextPart_000_003D_01C2F774.E42EE220 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>Hi!</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>I have to manage the bandwitdh of a = cable operator=20 and share it.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>They have a total bandwidth of 4Mb and = 250=20 customers connected on this network.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>They divided their bandwith in 3=20 category:</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>64kb =3D> subnet = 172.16.64.X</FONT></DIV> <DIV><FONT face=3DArial size=3D2>128k =3D> subnet = 172.16.128.X</FONT></DIV> <DIV><FONT face=3DArial size=3D2>256k =3D> subnet = 172.16.254.X</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>So I have to limit the bandwith of = eith=20 user:</FONT></DIV> <DIV><FONT face=3DArial size=3D2>64Kb for a user in the subnet=20 172.16.64.X</FONT></DIV> <DIV><FONT face=3DArial size=3D2>....</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>After reading the LARC HOWTO, = i tried to=20 make a script for sharing the bandwith.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>The example 12.4 (Hashing filters for = very fast=20 massive filtering) correspond exactly to my problem</FONT> <FONT = face=3DArial=20 size=3D2>but i'm not able to implement it,</FONT></DIV> <DIV><FONT face=3DArial size=3D2>my script doesn't work, the bandwitdh = is not=20 share.:((</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Can anyone can help me and tell me what = is wrong in=20 my script below?</FONT></DIV> <DIV><FONT face=3DArial size=3D2>The only difference i see between my = script and the=20 example in the howto is:</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>- In my script i define the rules for = ip=20 dst</FONT></DIV> <DIV><FONT face=3DArial size=3D2>-In the howto they define the rules for = ip=20 src</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Thank you very much for your = help</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>The script:</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>tc qdisc del dev eth1 root</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>tc qdisc add dev eth1 root handle 1:0 = cbq bandwidth=20 4Mbit avpkt 1000 cell 8</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV><FONT face=3DArial = size=3D2> <DIV><BR>tc class add dev eth1 parent 1:0 classid 1:1 cbq bandwidth = 64kbit=20 \<BR>rate 64kbit prio 5 allot 1514 weight 6kbit cell 8 = maxburst=20 20 \<BR>avpkt 1000 isolated</DIV> <DIV> </DIV> <DIV>tc class add dev eth1 parent 1:0 classid 1:2 cbq bandwidth 128kbit=20 \<BR>rate 128kbit prio 5 allot 1514 weight 12kbit cell 8 maxburst=20 20 \<BR>avpkt 1000 isolated</DIV> <DIV> </DIV> <DIV>tc class add dev eth1 parent 1:0 classid 1:3 cbq bandwidth = 256kbit =20 \<BR>rate 256kbit prio 5 allot 1514 weight 25kbit cell 8 maxburst=20 20 \<BR>avpkt 1000 isolated</DIV> <DIV> </DIV> <DIV>tc filter add dev eth1 parent 1:0 prio 5 protocol ip u32<BR>tc = filter add=20 dev eth1 parent 1:0 prio 5 handle 2: u32 divisor 256</DIV> <DIV> </DIV> <DIV>j=3D0;<BR>while [ $j -le 255 ]; do<BR>hex=3D`echo "obase=3D16; $j" = |bc`<BR>tc=20 filter add dev eth1 protocol ip parent 1:0 prio 5 u32 ht 2:$hex: = \<BR>match ip=20 dst 172.16.64.$j flowid 1:1<BR>tc filter add dev eth1 protocol ip parent = 1:0=20 prio 5 u32 ht 2:$hex: \<BR>match ip dst 172.16.128.$j flowid 1:2<BR>tc = filter=20 add dev eth1 protocol ip parent 1:0 prio 5 u32 ht 2:$hex: \<BR>match ip = dst=20 172.16.254.$j flowid 1:3<BR>j=3D$((j+1))<BR>done</DIV> <DIV> </DIV> <DIV>tc filter add dev eth1 protocol ip parent 1:2 prio 5 u32 ht 800::=20 \<BR>match ip dst 172.16.0.0/16 \<BR>hashkey mask 0x000000ff at 12 = \<BR>link=20 2:<BR><BR></FONT><FONT face=3DArial size=3D2></FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Michael = Richez.</DIV></FONT></BODY></HTML> ------=_NextPart_000_003D_01C2F774.E42EE220--
On Monday 31 March 2003 11:01, hotmail wrote: > 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 Some remarks. - Bandwidth is the real link bandwidth. So if you have a 100mbit link, it's 100mbit. - Remove all the isolated parameters. It's not working and it can disturb the cbq setup. - Create 1 bounded root class with rate = link bandwidth and attach all other classes (1,2 and 3 in your case) to that class. - Try htb if you can (kernel 2.4.20 has htb support, for older kernels, you need a patch). Maybe the docs on www.docum.org can 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: -- stef.coene@docum.org "Using Linux as bandwidth manager" http://www.docum.org/ #lartc @ irc.oftc.net