From: "Indunil Jayasooriya" Date: Fri, 10 Aug 2007 11:26:43 +0000 Subject: Re: [LARTC] Allocating 64 kbits/s out of 256 kbits/s for one LAN Message-Id: <7ed6b0aa0708100414t78855ee8s348aceffce08a84@mail.gmail.com> MIME-Version: 1 Content-Type: multipart/mixed; boundary="===============1601702298==" List-Id: References: <7ed6b0aa0708020218j7131222cqe38d0c05ab59d504@mail.gmail.com> In-Reply-To: <7ed6b0aa0708020218j7131222cqe38d0c05ab59d504@mail.gmail.com> To: lartc@vger.kernel.org --===============1601702298== Content-Type: multipart/alternative; boundary="----=_Part_37006_17224528.1186744483511" ------=_Part_37006_17224528.1186744483511 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Paolo Malfatti, Thanks for your script. It works fine. I get what I expect. THANK you all the way until it comes to an end. FOR the benifit for evryone in the LIST. HERE IS the SCRIPT AGAIN. INTERFAZ_LAN=3Deth0 FULLBANDWIDTH=3D256 BANDWIDTH4LAN=3D64 tc qdisc del root dev $INTERFAZ_LAN tc qdisc add dev $INTERFAZ_LAN root handle 1 htb r2q 4 tc class add dev $INTERFAZ_LAN parent 1: classid 1:2 htb rate "$FULLBANDWIDTH"Kbit tc class add dev $INTERFAZ_LAN parent 1: classid 1:5 htb rate "$BANDWIDTH4LAN"Kbit tc qdisc add dev $INTERFAZ_LAN parent 1:5 handle 5 sfq perturb 10 tc filter add dev $INTERFAZ_LAN parent 1:0 protocol ip prio 1 u32 match ip dst 192.168.101.0/24 classid 1:5 On 8/8/07, Pio Mendez wrote: > > This script only shape the outgoing traffic (upload) in a NAT firewall. T= o > shape the incoming traffic (downloads) there is a simpler script: > > INTERFAZ_LAN=3Deth0 > > FULLBANDWIDTH=3D256 > > BANDWIDTH4LAN=3D64 > > tc qdisc del root dev $INTERFAZ_LAN > > tc qdisc add dev $INTERFAZ_LAN root handle 1 htb r2q 4 > tc class add dev $INTERFAZ_LAN parent 1: classid 1:2 htb rate > "$FULLBANDWIDTH"Kbit > tc class add dev $INTERFAZ_LAN parent 1: classid 1:5 htb rate > "$BANDWIDTH4LAN"Kbit > tc qdisc add dev $INTERFAZ_LAN parent 1:5 handle 5 sfq perturb 10 > tc filter add dev $INTERFAZ_LAN parent 1:0 protocol ip prio 1 u32 match i= p > dst 192.168.101.0/24 classid 1:5 > > Regards > > Paolo Malfatti > > PS: dont forget to put a "tc qdisc del root dev $INTERFAZ_INT" rule at > the beginning of your previous script. > > > > ------------------------------ > From: *"Indunil Jayasooriya" * > To: *"Pio Mendez" , lartc@mailman.ds9a.nl* > Subject: *Re: [LARTC] Allocating 64 kbits/s out of 256 kbits/s for one > LAN behingfirewall* > Date: *Wed, 8 Aug 2007 12:30:59 +0530* > > Hi Paolo Malfatti, > > > Thanks for your script. I tried it . > > But I still can not allocate 64 kbit for LAN. We have a 256 kbit link. > We usually download around @ 30-33 kbytes per second. That means, when i= t > comes to kbits, I will have to mulitple it in to 8 as > 1kbps=3D8kbit . > > pls see below for usual download rate, before applying your rules. > > [root@worldnet wget]# wget http://mirrors.kernel.org/centos/5.0/isos/i38= 6/CentOS-5.0-i386-bin-6of6.iso > > > --12:16:27-- > http://mirrors.kernel.org/centos/5.0/isos/i386/CentOS-5.0-i386-bin-6of6.i= so > =3D> `CentOS-5.0-i386-bin-6of6.iso.1 > ' > Resolving mirrors.kernel.org... 204.152.191.7, 204.152.191.39 > Connecting to mirrors.kernel.org|204.152.191.7|:80... connected. > HTTP request sent, awaiting response... 200 OK > > Length: 407,005,184 (388M) [application/x-iso9660-image] > > 0% > [ > ] 2,749,752 30.10K/s ETA 4:43:0 > > > Then, I applied your rules. pls see below > > > INTERFAZ_INT=3Deth0 > > FULLBANDWIDTH=3D256 > > BANDWIDTH4LAN=3D64 > > iptables -t mangle -A PREROUTING -s 192.168.101.0/24-j MARK --set-mark 0x5 > > tc qdisc add dev $INTERFAZ_INT root handle 1 htb r2q 4 > tc class add dev $INTERFAZ_INT parent 1: classid 1:2 htb rate > "$FULLBANDWIDTH"Kbit > tc class add dev $INTERFAZ_INT parent 1: classid 1:5 htb rate > "$BANDWIDTH4LAN"Kbit > > tc qdisc add dev $INTERFAZ_INT parent 1:5 handle 5 sfq perturb 10 > tc filter add dev $INTERFAZ_INT protocol ip parent 1: pref 1 handle 5 fw > classid 1:5 > > > Still no luck. after applying rules, I downloaded an centos ISO image. Bu= t > , I still can download @ usual rate. ( > i.e 30-33 kbytes per seconds). > > If your rules work, I will be able to download @ about 8 kbyes per second= . > (i.e - 8*8 kbit=3D 64 kbit) > > That is what I expect ? > > Where have I gone wrong? > > > > > On 8/7/07, Pio Mendez wrote: > > > > >What is r2q ad 4 there ?. I do not understand those two. > I recommend you to read this: > > > http://luxik.cdi.cz/~devik/qos/htb/ > > > > > > the r2q is a divisor used to calculate the quantum of htb (the amount > of bytes that will be transmitted before serving another class: quantum = =3D > rate / r2q). > > >tc qdisc add dev $INTERFAZ_INT parent 1:5 handle 5 sfq perturb 10 > >What is this above rule?, I don not understand at all. > a must: http://lartc.org/howto/lartc.qdisc.html > > The classes do shape of traffic, but you need a Queue manager to trasmit > it (qdisc rule). Here you will find an example of HTB script: > > http://lartc.org/howto/lartc.qdisc.classful.html#AEN1072 > > >tc filter add dev $INTERFAZ_INT protocol ip parent 1: pref 1 handle 10 > fw classid 1:5 > >I do not understand the above rule too. > > there is an error: the right filter rule is: > tc filter add dev $INTERFAZ_INT protocol ip parent 1: pref 1 handle 5 fw > classid 1:5 > > The filter rule filter the traffic and send the mathing packets to the > right class. > The iptables MARK rule mark the traffic before the SNAT. Later, after al= l > iptables processing, the packets are filtered by this rule; if some packe= t > match the "handle 5" filter (packet marked with 5 by the iptables rule w= ill > > match) then it will be shaped by htb class to 64kbps. > > Hope this will help > Regards > Paolo Malfatti > > > ------------------------------ > MSN Amor Busca tu =BD naranja > > > > > -- > Thank you > Indunil Jayasooriya > > > ------------------------------ > Charla con tus amigos en l=EDnea mediante MSN Messenger: Haz clic aqu=ED<= http://g.msn.com/8HMBES/2728??PS=3D47575> --=20 Thank you Indunil Jayasooriya ------=_Part_37006_17224528.1186744483511 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Paolo Malfatti,

Thanks for your script. It works fine.

I= get what I expect.

THANK you all the way until it comes to an end.=

FOR the benifit for evryone in the LIST.

HERE IS the SCRIPT= AGAIN.=20

INTERFAZ_LAN=3Deth0 

FULLBANDWIDTH=3D256

BANDWIDTH4LAN=3D64

tc qdisc del root dev $INTERFAZ_LAN

tc qdisc add dev $INTERFAZ_LAN root hand= le 1 htb r2q 4
tc class add dev $INTERFAZ_LAN parent 1: classid 1:2 htb= rate "$FULLBANDWIDTH"Kbit
= tc class add dev $INTERFAZ_LAN parent 1: classid 1:5 htb rate "$BANDWI= DTH4LAN"Kbit
tc qdisc add dev $INTERFAZ_LAN parent 1:5 handle 5 sfq perturb 10
tc fi= lter add dev $INTERFAZ_LAN parent 1:0 protocol ip prio 1 u32 match ip = dst 192.168.10= 1.0/24 classid 1:5



On 8/8/07, P= io Mendez <pio_mendez@hotm= ail.com> wrote:

This script only shape the outgoing traffic (upload) in a NAT firewall. = To shape the incoming traffic (downloads) there is a simpler script: <= /p>

INTERFAZ_LAN=3Deth0 

FULLBANDWIDTH=3D256

BANDWIDTH4LAN=3D64

tc qdisc del root dev $INTERFAZ_LAN

tc qdisc add dev $INTERFAZ_LAN root handle 1 htb r2q 4
tc class = add dev $INTERFAZ_LAN parent 1: classid 1:2 htb rate "$FULLBANDWIDTH&q= uot;Kbit
tc class add dev $INTERFAZ_LAN parent 1: classid 1:5 htb rate &= quot;$BANDWIDTH4LAN"Kbit=20
tc qdisc add dev $INTERFAZ_LAN parent 1:5 handle 5 sfq perturb 10<= br>tc filter add dev $INTERFAZ_LAN parent 1:0 protocol ip prio 1 u32 m= atch ip dst 192.168.101.0/24 classid 1:5

Regards

Paolo Malfatti

PS: dont forget to put a "tc qdisc del root dev $INTERFAZ_INT"= rule  at the beginning of your previous script.

 


From:  "Indunil Jayasooriya" <indunil75@gmail.com>
T= o:  "Pio Mendez" < pio_mendez@hotmail.com>, <= a href=3D"mailto:lartc@mailman.ds9a.nl" target=3D"_blank" onclick=3D"return= top.js.OpenExtLink(window,event,this)"> lartc@mailman.ds9a.nl
Subject:  Re: [LARTC] Allocat= ing 64 kbits/s out of 256 kbits/s for one LAN behingfirewall
Date:&n= bsp; Wed, 8 Aug 2007 12:30:59 +0530


= Hi Paolo Malfatti,


=
Thanks for your script. I tried it .

 B= ut I still can not allocate 64 kb= it for LAN.  We have a 256 kbit link. We usually download around @ 30-= 33  kbytes per second. That means, when it comes to kbits, I will have= to mulitple it in to 8  as

1kbps=3D8kbit .

pls see= below for usual download  rate, before applying your rules.

[root@worldnet wget]# wget  http://mirrors.kernel.org/centos/5.0/isos/i386/CentOS-5.0-i386-bin-6of6.iso


--12:16:27--  http://mirrors.kernel.or= g/centos/5.0/isos/i386/CentOS-5.0-i386-bin-6of6.iso
           =3D>= ; `CentOS-5.0-i386-bin-6of6.iso.1
'
Resolving mirrors.kernel.org... 204.152.191.7, 204.152.191.39Connecting to mirrors.kernel.org|204.152.191.7|:80... connected.
HTTP r= equest sent, awaiting response... 200 OK

Length: 407,005,184 (388M) [application/x-iso9660-image]
 0% [          &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;        ] 2,749,752  &nbs= p; =20 30.10K/s  ETA 4:43:0


= Then, I applied your rules. pls see below



INTERFA= Z_INT=3Deth0 

FULLBAN= DWIDTH=3D256

BANDWID= TH4LAN=3D64

iptable= s -t mangle -A PREROUTING -s 192.168.10= 1.0/24 -j MARK --set-mark 0x5

tc qdis= c add dev $INTERFAZ_INT root handle 1 htb r2q 4
tc class add dev $I= NTERFAZ_INT parent 1: classid 1:2 htb rate "$FULLBANDWIDTH"Kbit tc class add dev $INTERFAZ_INT parent 1: classid 1:5 htb rate "$BANDWI= DTH4LAN"Kbit


tc qdisc add dev $INTERFAZ_INT parent 1:5 handle 5 sfq= perturb 10
tc filter add dev $INTERFAZ_INT protocol ip parent 1: pref 1= handle 5 fw classid 1:5


Still no luck. after applying rules, I downloaded an centos ISO ima= ge. But , I still can download @ usual rate. (
i.e 30-33 kbytes per seconds).

If your rules work, I will b= e able to download @ about 8 kbyes per second. (i.e - 8*8 kbit=3D 64 kbit)

That is what I expect ?

Where have I gone wrong?



On 8/7/07, Pio Mendez<= /b> < pio_mendez@hotmail.com> wrote:
>What is r2q= ad 4 there ?. I do not understand those two.
I recommend you= to read this:

http://luxik.cdi.cz/~devik/qos/h= tb/

the r2q is a divi= sor used to calculate the quantum of htb (the amount of bytes that will be = transmitted before serving another class: quantum =3D rate / r2q).

>tc = qdisc add dev $INTERFAZ_INT parent 1:5 handle 5 sfq perturb 10<= /p>

 = ;  >What is this above rule?, I don not understand at all.
 = ;
The c= lasses do shape of traffic, but you need a Queue manager to trasmit it (qdi= sc rule).  Here you will find an example of HTB script:
http://lartc.org/howto/lartc.qdisc.classful.html#AEN1072
 = ;
>t= c filter add dev $INTERFAZ_INT protocol ip parent 1: pref 1 handle 10 = fw classid 1:5
>I do not understand the above rule too.

there is an error: = the right filter rule is:=20
tc fi= lter add dev $INTERFAZ_INT protocol ip parent 1: pref 1 handle 5 fw cl= assid 1:5
 = ;
The f= ilter rule filter the traffic and send the mathing packets to the right cla= ss.
The i= ptables MARK rule mark the traffic before the SNAT. Later, after all iptabl= es processing, the packets are filtered by this rule; if some packet m= atch the "handle 5" filter (packet marked with 5 by the  ipt= ables rule will=20
match= ) then it will be shaped by htb class to 64kbps.
 = ;
Hope = this will help
Regar= ds
Paolo= Malfatti
 = ;


MSN Amor <= a href=3D"http://g.msn.com/8HMAES/2740??PS=3D47575" target=3D"_blank" oncli= ck=3D"return top.js.OpenExtLink(window,event,this)">Busca tu =BD naranja




--
Thank you
Indunil Jayasooriy= a


=
Charla con tus amigos en l=EDnea mediante MSN Messenger: Haz clic aqu=ED=20



--
Thank you
Ind= unil Jayasooriya
------=_Part_37006_17224528.1186744483511-- --===============1601702298== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc --===============1601702298==--