Re: [LARTC] HTB + GRED (santa clauss plz help me out)

2004-12-31 Thread Andy Furniss
Antonios Chalkiopoulos wrote:
I 've been trynig for a long time now to make HTB and GRED to work togethen. 
The problem beeing that GRED doesn't use handles (instead it uses DP:1 DP:2 
etc) i can not preperly filter traffic to them.

Tomas Graf suggested to use the tc_index index of u32 classifier
so dear Sant .. i am currently with the following scripts that works! 
Have you seen this
http://www.opalsoft.net/qos/DS-27.htm
Though if it works you don't need it :-)
But when i try to add an HTB before the GRED, everything goes to hell.
You may need to repeat filters to get HTB to go from root to GRED (well 
you do with PRIO) eg. from a usenet post.


> Hi Everyone
>
> I'm running Fedora Core 2 as a router and am having problems getting the
> PRIO qdisc to work.
>
> I'm using the Iperf utility to generate traffic flows between 
computers on
> either side of the Fedora box.  I want traffic destined to port 6001 
to be
> in band 0, traffic for port 6002 in band 1 and traffic for port 6003 in
> band 2.
>
> I'm using HTB to restrict the overall bandwidth to 5000 kbit.
>
> So far I've developed the following scripts, based on info I've picked up
> from the LARTC mailing list archives, man pages and Google searches.
>
> SCRIPT ONE...
>
> tc qdisc del dev eth1 root
> tc qdisc add dev eth1 root handle 1: htb default 1
> tc class add dev eth1 parent 1: classid 1:1 htb rate 5000kbit
> tc qdisc add dev eth1 parent 1:1 handle 10: prio
> tc filter add dev eth1 parent 1:0 protocol ip handle 1 fw flowid 10:1
> tc filter add dev eth1 parent 1:0 protocol ip handle 2 fw flowid 10:2
> tc filter add dev eth1 parent 1:0 protocol ip handle 3 fw flowid 10:3

This is the bit that doesn't work as I expected.
Seems HTB doesn't forward direct to prio bands from root so you have to
repeat the filters.
Below is what just seemed to work for me - It works without the bfifos
aswell but you don't get per band stats with tc -s qdisc ls dev eth0 if you
don't have them.
Andy.
IPTABLES=/usr/local/sbin/iptables
MODPROBE=/sbin/modprobe
IP=/usr/sbin/ip
TC=/usr/sbin/tc
$IPTABLES -t mangle -D POSTROUTING --dst 192.168.0.1 -j MARK --set-mark 2
&>/dev/null
$IPTABLES -t mangle -D POSTROUTING --dst 192.168.0.2 -j MARK --set-mark 3
&>/dev/null
$IPTABLES -t mangle -D POSTROUTING -m length --length 0:64 -j MARK
--set-mark 1 &>/dev/null
$TC qdisc del dev eth0 root &>/dev/null
if [ "$1" = "stop" ]
then
echo "stopped"
exit
fi
$IPTABLES -t mangle -A POSTROUTING --dst 192.168.0.1 -j MARK --set-mark 2
$IPTABLES -t mangle -A POSTROUTING --dst 192.168.0.2 -j MARK --set-mark 3
$IPTABLES -t mangle -A POSTROUTING -m length --length 0:64 -j MARK
--set-mark 1
$TC qdisc add dev eth0 root handle 1:0 htb default 0
$TC class add dev eth0 parent 1:0 classid 1:1 htb rate 5mbit
$TC qdisc add dev eth0 parent 1:1 handle 2: prio
$TC qdisc add dev eth0 parent 2:1 handle 10:0 bfifo limit 64k
$TC qdisc add dev eth0 parent 2:2 handle 20:0 bfifo limit 64k
$TC qdisc add dev eth0 parent 2:3 handle 30:0 bfifo limit 64k
$TC filter add dev eth0 parent 1:0 prio 0 protocol ip handle 1 fw flowid 1:1
$TC filter add dev eth0 parent 1:0 prio 1 protocol ip handle 2 fw flowid 1:1
$TC filter add dev eth0 parent 1:0 prio 2 protocol ip handle 3 fw flowid 1:1
$TC filter add dev eth0 parent 2:0 prio 0 protocol ip handle 1 fw flowid 2:1
$TC filter add dev eth0 parent 2:0 prio 1 protocol ip handle 2 fw flowid 2:2
$TC filter add dev eth0 parent 2:0 prio 2 protocol ip handle 3 fw flowid 2:3
Andy.
___
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] qdisc statistics

2004-12-31 Thread Thomas Graf
* felix <[EMAIL PROTECTED]> 2004-12-31 13:35
> My understanding is that the lended and borrowed stats are expressed as 
> a number of packets but over what time period do the numbers refer?

Since the qdisc/class was loaded or since the last overflow. For
the sent statistics, both byte and packet counter exist.

> In addition, for a particular class why do the lended and borrowed 
> figures add up to the sent value? That is, if a class 'lends' bandwidth, 
> why do the packets still appear in its 'sent' stat alongside those it 
> borrowed?

Those are qdisc specific statistics. borrowed may even have a different
unit depending on your compile time options. What particular qdisc are
you refering to?

> How do I obtain the actual rate used for a class - as opposed to the 
> assigned rate? This is what I really want and I was hoping there would 
> be some relationship such as:

Set up a rate estimator it will return the current estimated rate
in pps/bps. You may specify whatever time interval you prefer.
Note: the rate estimator uses sent statistics which are counted
in enqueue, therefore no borrowing taken into account.

> the lended and borrowed stats refer. Also, lended and borrowed are given 
> in packets, the rates are expressed in bytes or bits per second, so 
> presumably, I will need to calculate an average packet size.

In HTB yes, CBQ can also count in bytes.
___
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] shaping on tcp ports

2004-12-31 Thread Stef Coene
On Friday 31 December 2004 12:44, Paras pradhan wrote:
> how do we mark in single iptables line using for ex: --dport 21 and -d
> 192.168.3.88
> or have to do seperatly.
I'm not sure if you can do it in 1 command.  Just try it out.

Stef
___
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


[LARTC] qdisc statistics

2004-12-31 Thread felix
Hi,
I am trying to relate the lended and borrowed statistics to the others 
and, in particular, compare them with the assigned rates for each class.

My understanding is that the lended and borrowed stats are expressed as 
a number of packets but over what time period do the numbers refer?

In addition, for a particular class why do the lended and borrowed 
figures add up to the sent value? That is, if a class 'lends' bandwidth, 
why do the packets still appear in its 'sent' stat alongside those it 
borrowed?

How do I obtain the actual rate used for a class - as opposed to the 
assigned rate? This is what I really want and I was hoping there would 
be some relationship such as:

actual rate = assigned rate + borrowing rate - lending rate
except, as mentioned above, I need to know the time period over which 
the lended and borrowed stats refer. Also, lended and borrowed are given 
in packets, the rates are expressed in bytes or bits per second, so 
presumably, I will need to calculate an average packet size.

Many thanks for your help,
Happy New Year,
-Paul

___
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] shaping on tcp ports

2004-12-31 Thread Paras pradhan

> On Wednesday 29 December 2004 13:50, Paras pradhan wrote:
>> hi all:
>>
>> the following scipt is wokring perfectly with limiting ...on limimitng
>> per ip basis..
>>
>>
>> 
>> eth0=public static ip
>> eth2= private ip ( 192.168.2.1)
>> --
>> iptables -t mangle -A POSTROUTING -s ! 192.168.0.0/32 -d
>> 192.168.2.101/32 -j MARK --set-mark 21012
>>
>> tc class add dev eth2 parent 1:1 classid 1:2101 htb rate 32kbit ceil
>> 64kbit
>>
>> tc filter add dev eth2 parent 1:0 protocol ip prio 2 handle 21012 fw
>> classid 1:2101
>>
>> tc qdisc add dev eth2 parent 1:2101 handle 2101: sfq perturb 10
>>
>> -
>>
>> Now what i am trying to do is... limiting 192.168.2.101 75% for httpd
>> and 25% to rest..
>>
>> what i have to do? i am confused on iptables marking as well..
> You need 2 htb classes, 1 for httpd and 1 for the rest.
> And you need 2 iptables rules, 1 to mark httpd and 1 to mark the rest.
> And you need 2 filter rules, 1 to put the marked httpd traffic in the
> httpd  class and to put the other traffic in the other class.
>
> Stef
> ___
> LARTC mailing list / LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


how do we mark in single iptables line using for ex: --dport 21 and -d
192.168.3.88
or have to do seperatly.



Thanks
Paras.


Paras pradhan
Systems Dept.
Bajranet PVT LTD
Kathmandu
Nepal.


___
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


[LARTC] Giving high proprity to SIP packets

2004-12-31 Thread Ramasubramaniyan Srinivasan
Hi

I want to give high priority to SIP packets that are flowing out of my
system. I want to use RED or TBF for it. I dont know where to start
from. Since my system is not supporting HTB..i am not able to get hold
of some guidelines to implement the same. Looking forward to some
help.

regards
Sriram
___
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/