From: "Salatiel Filho" Date: Mon, 23 Apr 2007 13:48:12 +0000 Subject: Re: [LARTC] Shape own router Message-Id: MIME-Version: 1 Content-Type: multipart/mixed; boundary="===============0547167902==" List-Id: References: In-Reply-To: To: lartc@vger.kernel.org --===============0547167902== Content-Type: multipart/alternative; boundary="----=_Part_7861_8949176.1177336092128" ------=_Part_7861_8949176.1177336092128 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 3/24/07, Andy Furniss wrote: > > Salatiel Filho wrote: > > > > > Hi Andy , thanks again , but i am not understanding very well how to > > do it [still newbie in this]. Let`s try to change to some real code > > here. This is part of my setup to shape download: > > > > eth0 =3D EXTIF > > eth1 =3D LOCALIF > > > > # SHAPE DOWNLOAD to LOCALNET NOT COMING FROM THE ROUTER ITSELF [samba > > for example] > > iptables -t mangle -s ! 192.168.254.254 -A POSTROUTING -o eth1 -j IMQ > > --todev 1 > > If you shape your wan - eth0 using ifb on ingress or imq from prerouting > then you do not need any rules on eth1, the wan traffic will already be > shaped. > > If you do not plan on seperating users or interactive traffic from bulk > traffic, it would actually be much nicer to use a policer for ingress > wan traffic. Policing doesn't buffer traffic just drops it when a > virtual buffer is full, so you won't be delaying interactive traffic by > queuing with bulk. > > When you shape ingress wan, however you do it, you will need to > sacrifice about 20% of your bandwidth, possibly more depending on > needs/traffic/wan speed. Shaping from the wrong end of the bottleneck is > better than doing nothing, but you can't do it perfectly. > > > > > tc qdisc add dev imq1 root handle 1: htb default 3 r2q 1 // > > DOWNLOAD SHAPER ROOT > > tc class add dev imq1 parent 1: classid 1:1 htb rate 2048kbit quantum > > 1500 //KNOWN TRAFFIC GOES HERE > > tc class add dev imq1 parent 1: classid 1:3 htb rate 8kbit quantum > > 1500 // DEFAULT CLASS VERYYYYY SLOWWWWWWW > > If this were eth rather than imq you would be sending arp to a slow > class - not nice. > > Andy. > > I was finally able to shape the router itself :) , i changed IMQ default behaviour to AFTER NAT in Prerouting and BEFORE NAT in Postrouting. I do not know if my setup is common , but i have some like this: DOWNLOAD LINK [1024K] -> HTB PEOPLE [500k-1024ceil] guy1 [100k-1000ceil] guy2 [100k-1000ceil] guy3 [100k-1000ceil] guy4 [100k-1000ceil] guy5 [100k-1000kceil] ROUTER[512k-1000ceil] -> router and P2P BOX 24/7 [Before be abl= e to shape the router , i need to hard limit the download speed to not eat al= l bandwidth, now i can let it borrow if there is available bandwidth in the parent (DOWNLOAD LINK)] -> I really need this 512k rate guaranteed in the router. DEFAULT[8k-8k] -> In theory should not be used by anyone :) But now i have a doubt , when a packet gets in too htb it will be queued , right ? If it is, is there a way to drop it if it is over the ceil limit ? = I really do not want packets being queued `cause probably wiill delay the interactive traffic. Despite that , my setup is working great , that is jus= t a doubt :) --=20 []'s Salatiel "O maior prazer do inteligente =E9 bancar o idiota diante de um idiota que banca o inteligente". ------=_Part_7861_8949176.1177336092128 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

On 3/24/07, Andy Furniss <lists@andyfurniss.entadsl.com> wrote:
Salatiel Filho wrote:

>
> Hi Andy , thanks again , but i am= not understanding very well how to
> do it [still newbie in this].&n= bsp; Let`s try to change to some real code
> here. This is part = of my  setup to shape download:
>
> eth0 =3D EXTIF
> eth1 =3D LOCALIF
>
> # = SHAPE DOWNLOAD to LOCALNET NOT COMING FROM THE ROUTER ITSELF [samba
>= for example]
> iptables -t mangle -s ! 192.168.254.254 -A POSTROUTING -o eth1 -j IMQ
> --todev 1

= If you shape your wan - eth0 using ifb on ingress or imq from preroutingthen you do not need any rules on eth1, the wan traffic will already be
shaped.

If you do not plan on seperating users or interactive tr= affic from bulk
traffic, it would actually be much nicer to use a police= r for ingress
wan traffic. Policing doesn't buffer traffic just drop= s it when a
virtual buffer is full, so you won't be delaying interactive traffi= c by
queuing with bulk.

When you shape ingress wan, however you d= o it, you will need to
sacrifice about 20% of your bandwidth, possibly m= ore depending on
needs/traffic/wan speed. Shaping from the wrong end of the bottleneck i= s
better than doing nothing, but you can't do it perfectly.

&= gt;
> tc qdisc add dev imq1 root handle 1: htb  default 3 r= 2q 1   //
> DOWNLOAD SHAPER ROOT
> tc class add dev imq1 parent 1: class= id 1:1 htb rate 2048kbit quantum
> 1500 //KNOWN TRAFFIC GOES HERE
= > tc class add dev imq1 parent 1: classid 1:3 htb rate 8kbit quantum
> 1500  // DEFAULT CLASS VERYYYYY SLOWWWWWWW

If thi= s were eth rather than imq you would be sending arp to a slow
class - no= t nice.

Andy.


I was finally able to sh= ape the router itself :) , i changed IMQ default behaviour to AFTER NAT in = Prerouting and BEFORE NAT in Postrouting.
I do not know if my setup is common , but i have some like this:

DOWNLOAD LINK  [1024K]       &= nbsp;    -> HTB
         = ; PEOPLE [500k-1024ceil]
        = ;          guy1 [100k-1000ceil= ]
           &nbs= p;      guy2 [100k-1000ceil]
            = ;      guy3 [100k-1000ceil]
   &= nbsp;           &nbs= p;  guy4 [100k-1000ceil]
              &= nbsp;   guy5 [100k-1000kceil]

     &n= bsp;    ROUTER[512k-1000ceil]  -> router and P2P BOX= 24/7  [Before be able to shape the router , i need to hard limit the = download speed to not eat all bandwidth, now i can let it borrow if there i= s available bandwidth in the parent (DOWNLOAD LINK)] -> I really need th= is 512k rate guaranteed in the router.

          DEFAULT[8k-8= k]  -> In theory should not be used by anyone :)

  = ;         

But now i h= ave a doubt , when a packet gets in too htb it will be queued , right ? If = it is, is there a way to drop it if it is over the ceil limit ? I really do= not want packets being queued `cause probably wiill  delay the intera= ctive traffic. Despite that , my setup is working great , that is just a do= ubt :)


--
[]'s
Salatiel

"O maior = prazer do inteligente =E9 bancar o  idiota
   diant= e de um  idiota que banca o inteligente". ------=_Part_7861_8949176.1177336092128-- --===============0547167902== 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 --===============0547167902==--