LARTC
[Top] [All Lists]

Re: [LARTC] Shape own router

To: lists@andyfurniss.entadsl.com
Subject: Re: [LARTC] Shape own router
From: "Salatiel Filho" <salatiel.filho@gmail.com>
Date: Fri, 23 Mar 2007 13:45:11 -0300
Cc: lartc@mailman.ds9a.nl
Delivered-to: sp-com-lists@consult.net
Delivered-to: lartc-list@securepoint.com
Delivered-to: lartc@outpost.ds9a.nl
Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=DlbiUSQxQv5n1tNgMaFGoHXgwFXkTuAO+PaUyFeT1pDs37Co5dWqSoCP6pT05SgQcP53XAr3tLyzSPzMLHhZMbTaoDNvniIljpRS7DsLPWSKAtWV5jYEeCXl7npT8aMno6RsLOPqCjCbbCeAgQU7rvXFnRndHDIVjCB/R0s71uo=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=qhstCrXprXb1KLBmAvPUakUxHVRO4mHs+BlHUSvjcv17SsRjH0+gneXxCKsAnZQ7HlOOkM1434cgHP6y/hwDOu5tnzSUwQctnoZsWueDRxWHkZmws1izndnhu+rYQAnjEPoQZC4vSkcZOMXVgKGq9U9vWlhXCK6OvsAd1+PHj9E=
In-reply-to: <4603336E.5060501@andyfurniss.entadsl.com>
List-archive: <http://mailman.ds9a.nl/pipermail/lartc>
List-help: <mailto:lartc-request@mailman.ds9a.nl?subject=help>
List-id: "Mailinglist of the Linux Advanced Routing &amp; Traffic Control project" <lartc.mailman.ds9a.nl>
List-post: <mailto:lartc@mailman.ds9a.nl>
List-subscribe: <http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc>, <mailto:lartc-request@mailman.ds9a.nl?subject=subscribe>
List-unsubscribe: <http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc>, <mailto:lartc-request@mailman.ds9a.nl?subject=unsubscribe>
References: <beb91d720703221459q3e25aebbhe3c58a73b120c70f@mail.gmail.com> <460309CA.8050801@andyfurniss.entadsl.com> <beb91d720703221812s5ee44298i9073709c3f0c7d5a@mail.gmail.com> <4603336E.5060501@andyfurniss.entadsl.com>
Sender: lartc-bounces@mailman.ds9a.nl
On 3/22/07, Andy Furniss <lists@andyfurniss.entadsl.com> wrote:
Salatiel Filho wrote:

> Where can i read about IFB ? I try to google but i can not find too
> much info. maybe i am looking for the wrong words.  Maybe this is the
> solution, cause i would like to put both local traffic and forwarded
> traffic in the same htb queue.

It's quite new, it was designed as a replacement for imq, but doesn't
quite do everything it can.

Here's howto send all ip incoming on eth0 to ifb - it's called
intermediate functional block in kernel config.

IP=/sbin/ip
TC=/sbin/tc

$TC qdisc del dev ifb0 root &>/dev/null
$TC qdisc del dev eth0 ingress &>/dev/null
$IP link set ifb0 down &>/dev/null

if [ "$1" = "stop" ]
then
         echo "stopping"
         exit
fi

modprobe ifb
$TC qdisc add dev eth0 ingress
$IP link set ifb0 up

tc filter add dev eth0 parent ffff: \
protocol ip prio 10 u32 match u32 0 0 \
flowid 1:0 \
action mirred egress redirect dev ifb0

Then just add tc rules on ifb like any other device.


>
>>
>> If you really need imq you will need to check first imq option in kernel
>> config is set to A.
>
> If i put after NAT in prerouting , how can i shape upload by IP ?

I use iptables to mark unnatted addresses then shape on the real
interface using the marks with a filter to catch the rest (ie traffic
from shaping box to wan)

If you use IMQ then it's postrouting for egress - so you can use the
second option to choose whether it hooks before/after NAT.
ie. AB would hook after prerouting (de)nat but before postrouting nat.


Andy.
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 = EXTIF
eth1 = 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

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

# First class 1Mb shaped
tc class add dev imq1 parent 1:1 classid 1:2 htb rate 1024kbit quantum 1500

# Known ips
tc class add dev imq1 parent 1:2 classid  1:101 htb rate 100kbit ceil
900kbit prio 0 quantum 1500
tc qdisc add dev imq1 parent 1:101 handle 101: sfq perturb 5
tc filter add dev imq1 parent 1: protocol ip handle 101 fw flowid 1:101
iptables -t mangle -I POSTROUTING  -o eth1 -d 192.168.254.101 -j MARK
--set-mark 101

.... and a few others like this above ...
Well , that work great , but  how can i shape downloads in the own router.
        wget http://blahblahblah ....as a leaf of 1:2 like i did for
the others ? using iptables mark ...


Some code here would help :)








_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc



--
[]'s
Salatiel

"O maior prazer do inteligente é bancar o  idiota
  diante de um  idiota que banca o inteligente".
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

<Prev in Thread] Current Thread [Next in Thread>