From: "Indunil Jayasooriya" Date: Wed, 08 Aug 2007 07:12:59 +0000 Subject: Re: [LARTC] Allocating 64 kbits/s out of 256 kbits/s for one LAN Message-Id: <7ed6b0aa0708080000u6a2a91d9n502b3b008dc2097@mail.gmail.com> MIME-Version: 1 Content-Type: multipart/mixed; boundary="===============0745417784==" List-Id: References: <7ed6b0aa0708020218j7131222cqe38d0c05ab59d504@mail.gmail.com> In-Reply-To: <7ed6b0aa0708020218j7131222cqe38d0c05ab59d504@mail.gmail.com> To: lartc@vger.kernel.org --===============0745417784== Content-Type: multipart/alternative; boundary="----=_Part_155433_6031554.1186556459012" ------=_Part_155433_6031554.1186556459012 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 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.org/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.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. But = , 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 f= w > 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 all > 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 --=20 Thank you Indunil Jayasooriya ------=_Part_155433_6031554.1186556459012 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

Hi Paolo Malfatti,



Thanks for your script. I tried it .

 But I still can no= t allocate 64 kbit for LAN.  We have a 256 kbit link. We usually downl= oad around @ 30-33  kbytes per second. That means, when it comes to kb= its, I will have to mulitple it in to 8  as=20 1kbps=3D8kbit .

pls see below for usual download = ; rate, before applying your rule= s.

[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.org/centos/5.= 0/isos/i386/CentOS-5.0-i386-bin-6of6.iso
    &nb= sp;      =3D> `CentOS-5.0-i386-bin-6of6.iso.1 '
Resolving mirrors.kernel.org... 2= 04.152.191.7, 204.152.191.39
C= onnecting to mirrors.kernel.org|204.152.191.7|:80... connected.
HTTP req= uest sent, awaiting response... 200 OK
Length: 407,005,184 (388M) [application/x-iso9660-image]

 0= % [            =             &nb= sp;            =             &nb= sp;            =             &nb= sp;       ] 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&q= uot;Kbit
tc class add dev $INTERFAZ_INT parent 1: classid 1:5 htb rate &= quot;$BANDWIDTH4LAN"Kbit
tc qdisc add dev $INTERFAZ_INT parent 1:5 handle 5 sfq perturb 10<= br>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. But , I still can download @ usual rate. ( i.e 30-33 kbytes per seconds).

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

T= hat is what I expect ?

Where have I gone wrong?



On 8/7/07, P= io Mendez <pio_mendez@hotm= ail.com> wrote:
>What is r2q ad 4 there ?. I do not underst= and those two.
I rec= ommend you to read this:

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

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

   >What is this above rule?, I don not understand a= t all.
 
The classes do shape of traffic, but you need a Queue manager to trasm= it 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 handl= e 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&nb= sp;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 = all iptables processing, the packets are filtered by this rule; if som= e packet match the "handle 5" filter (packet marked with 5 by the=  iptables rule will=20
match) then it will be shaped by htb class to 64kbps.
 
Hope this will help
Regards
Paolo Malfatti
 


MSN = Amor Busca tu =BD nara= nja=20



--
Thank you
Ind= unil Jayasooriya
------=_Part_155433_6031554.1186556459012-- --===============0745417784== 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 --===============0745417784==--