Re: [LARTC] Priomap

2003-08-30 Thread Steffen Moser
Hi,

* On Fri, Aug 29, 2003 at 10:54 PM (+0200), Emmanuel SIMON wrote:

> When installing PRIO, it creates 3 "classes" with priority level according
> to the TOS.
> 
> That command line :
> # tc qdisc add dev eth0 root handle 1: prio
> give that result :
> # tc qd sh
> qdisc prio 1: dev eth0 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
> 
> How should i read that priomap, what does it mean and how to change it.

As far as I understood it, it behaves the same like the classless qdisc
"pfifo_fast" using its bands. 

The difference is that (when using the classful qdisc "prio") you have 
got real classes and you can also use classifiers to put packets into 
the classes. 

But, if there aren't any matching classifiers, the packets got distri-
buted to their according classes using the values within their Type
of Service field (TOS) and the given priomap. The default priomap is 
the one you've wrote above.  

What does the priomap "1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1" actually mean?

As it is stated in chapter 9.2.1.1 of the LARTC howto, there are six-
teen values for the TOS files (one byte):

 |  TOS Bits  MeansLinux PriorityBand
 |  
 |  0x0 0 Normal Service   0 Best Effort 1
 |  0x2 1 Minimize Monetary Cost   1 Filler  2
 |  0x4 2 Maximize Reliability 0 Best Effort 1
 |  0x6 3 mmc+mr   0 Best Effort 1
 |  0x8 4 Maximize Throughput  2 Bulk2
 |  0xa 5 mmc+mt   2 Bulk2
 |  0xc 6 mr+mt2 Bulk2
 |  0xe 7 mmc+mr+mt2 Bulk2
 |  0x108 Minimize Delay   6 Interactive 0
 |  0x129 mmc+md   6 Interactive 0
 |  0x1410mr+md6 Interactive 0
 |  0x1611mmc+mr+md6 Interactive 0
 |  0x1812mt+md4 Int. Bulk   1
 |  0x1a13mmc+mt+md4 Int. Bulk   1
 |  0x1c14mr+mt+md 4 Int. Bulk   1
 |  0x1e15mmc+mr+mt+md 4 Int. Bulk   1

Using the default priomap will send packets with a TOS value of 0x10, 
0x12, 0x14 or 0x16 to class 0, packets with a TOS value of 0x0, 0x4,
0x6, 0x18, 0x1a, 0x1c, 0x1e to class 1 and packets with a TOS value
of 0x2, 0x8, 0xa, 0xc and 0xe to class 2. 

The "prio" qdisc now will dequeue packets from class 0 with the
highest priority. The higher the class numbers the lower the de-
queue priority.

If you would like to send packets with a TOS value of 0x0, 0x2, 0x4,
0x6, 0x8 to class 1 and packets with all other TOS values to class 0
you could change your priomap such (you have to state it when setting
up the "prio" qdisc if you want to have something different from the
default priomap):

  1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 

The TOS bits have the following meaning:

 |  Binary Decimcal  Meaning
 |  -
 |  1000   8 Minimize delay (md)
 |  0100   4 Maximize throughput (mt)
 |  0010   2 Maximize reliability (mr)
 |  0001   1 Minimize monetary cost (mmc)
 |     0 Normal Service

Of course, they can be combind, and so you can get these 16 values (2^4)
which are stated in the upper table.

You'll find very good documentation not only within the LARTC howto
(chapters 9.2.1 [1] and 9.5.3 [2]) but also within [3].

HTH,
Steffen

[1] http://lartc.org/howto/lartc.qdisc.classless.html#AEN659
[2] http://lartc.org/howto/lartc.qdisc.classful.html#AEN899
[3] http://opalsoft.net/qos/DS-23.htm
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] Please check the follow script for diffserv

2003-08-19 Thread Steffen Moser
Hi Damion,

* On Tue, Aug 19, 2003 at 09:41 AM (+1000), Damion de Soto wrote:

> Raghuveer wrote:
> 
> >I feel it gets the interface bandwidth.
>
> yes, it does.
> you need the interface bandwidth for the cbq qdisc:
> http://lartc.org/howto/lartc.qdisc.classful.html#AEN935

Given a 10 Mbit/s ethernet device (eth0) which is used to establish a
PPP over ethernet (PPPoE) connection (ppp0) to a broadband ISP (e.g. 
using ADSL, SDSL and so on as an underlaying system). 

If I then want to shape the traffic I send to the "ppp0" interface,
which bandwidth would be used for setting up a CBQ? 

I suppose that here the "virtual" (e.g. limited by the ISP) bandwidth 
of my "ppp0" connection (e.g. 128 kbit/s) is the interesting one, not 
the bandwidth of my "eth0" (10 Mbit/s), because the CBQ is attached
to the "ppp0" device and has nothing to do with the underlaying "eth0".

Is this assumption correct?

TIA,
Steffen
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


[LARTC] Compile error "iproute2"

2003-08-18 Thread Steffen Moser
Hi,

I am trying to compile "iproute2" (iproute2-2.4.7-now-ss020116-try.tar.gz, 
inclusively the latest HTB patch, activated diffserv components) on a 
SuSE-Linux 8.2 system (using "gcc 3.3", system based on "glibc 2.3.2"). 

It is no problem as long as I use the kernel header files of linux-2.4.20
(vanilla), linux-2.4.20.SuSE (special kernel patched by SuSE, shipped
with SuSE 8.2) or linux-2.4.21 (vanilla).

As soon as I use the header files of "linux-2.4.22-rc2" (i.e.
"/usr/src/linux" links to "/usr/src/linux-2.4.22-rc2") the compile
process breaks up very shortly after staring:

 | [EMAIL PROTECTED]:~/tools/iproute2> make
 | 
 | make[1]: Entering directory `/home/steffen/tools/iproute2/lib'
 | gcc -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -g -I../include-glibc 
-I/usr/include/db3 -include ../include-glibc/glibc-bugs.h -I/usr/src/linux/include 
-I../include -DRESOLVE_HOSTNAMES -c -o ll_map.o ll_map.c
 | In file included from ../include-glibc/netinet/in.h:7,
 |  from ll_map.c:19:
 | /usr/src/linux/include/linux/in.h:140: error: field `gr_group' has incomplete type
 | /usr/src/linux/include/linux/in.h:146: error: field `gsr_group' has incomplete type
 | /usr/src/linux/include/linux/in.h:147: error: field `gsr_source' has incomplete type
 | /usr/src/linux/include/linux/in.h:153: error: field `gf_group' has incomplete type
 | /usr/src/linux/include/linux/in.h:156: error: field `gf_slist' has incomplete type
 | ll_map.c: In function `ll_remember_index':
 | ll_map.c:77: warning: comparison between signed and unsigned
 | make[1]: *** [ll_map.o] Fehler 1
 | make[1]: Leaving directory `/home/steffen/tools/iproute2/lib'
 | make: *** [all] Fehler 2
 | 
 | [EMAIL PROTECTED]:~/tools/iproute2>

Of course, I know that "linux-2.4.22-rc2" is just a release candidate
but no official stable version. However, I'm going to ask this question:

Has anyone encountered the same problem? Is there any patch to solve it?

Regards,
Steffen
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] Remarking non conformant packets as AF13 from AF11

2003-08-18 Thread Steffen Moser
Hi Jesse,

* On Mon, Aug 18, 2003 at 07:23 AM (-0800), Jesse wrote:

> 
> Link='dev eth1'
> 
> Rate1='rate 800Kbit'
> Rate2='rate 2500Kbit'
> 
> Burst='burst 9K'
> 
> Action='continue'
> 
> Match1='match ip src 192.6.0.90 match ip dst 10.37.1.63 match ip sport 6970 0x 
> match ip protocol 17 0xff'
> Match2='match ip src 192.6.0.90 match ip dst 10.37.1.63 match ip dport 5005 0x 
> match ip protocol 17 0xff'
> Match3='match ip src 0/0'
> 
> Meter1="police $Rate1 $Burst $Action"
> Meter2="police $Rate2 $Burst $Action"
> 
> ./tc qdisc add $Link handle 1:0 root dsmark indices 64
> ./tc class change $Link classid 1:1 dsmark mask 0x3 value 0x28
> ./tc class change $Link classid 1:2 dsmark mask 0x3 value 0x38
> ./tc class change $Link classid 1:3 dsmark mask 0x3 value 0x0
> 
> ./tc filter add $Link parent 1:0 protocol ip prio 1 handle 1: u32 divisor 1
> ./tc filter add $Link parent 1:0 prio 1 u32 $Match1 $Meter1 flowid 1:1
> ./tc filter add $Link parent 1:0 prio 1 u32 $Match2 $Meter2 flowid 1:1
> ./tc filter add $Link parent 1:0 prio 1 u32 $Match3 flowid 1:3
> 
> 
> 
> There is traffic travelling across the network through two ports (6970 -
> Video streaming, and 5005 - Iperf traffic gernerator). When I monitor the
> packets using Ethereal, it can be seen that most packets are remarked
> 0x28 (AF11). However, non-conforming traffic is just remarked as 0x00 (BE
> class) which is not what I would like. I would like all non-conforming
> packets to be remarked 0x38 (AF13) which would afford them special
> treament further down my network.

Your filter rules don't put any traffic to "classid 1:2". Is that just 
a typo? 

What do you mean by "non-conforming traffic"? 

 - Traffic which comes from sport 6970 with a higher rate than
   $Rate1 as well as traffic which comes from sport 5005 with
   a higher rate than $Rate2?



Perhaps you can try such a filtering setup:

   ./tc filter add $Link parent 1:0 prio 1 u32 $Match1 $Meter1 flowid 1:1
   ./tc filter add $Link parent 1:0 prio 2 u32 $Match1 flowid 1:2

   ./tc filter add $Link parent 1:0 prio 3 u32 $Match2 $Meter2 flowid 1:1
   ./tc filter add $Link parent 1:0 prio 4 u32 $Match2 flowid 1:2
 
   ./tc filter add $Link parent 1:0 prio 5 u32 $Match3 flowid 1:3



> I have a suspiscion that it might have something to do with the fact the
> I am using "continue" as the action used for each of my meters, but can't
> be sure. If someone could clarify this or suggest anything or offer
> sample scripts then I'd be most grateful, or if anyone would like more
> details then I'd be happy to give it to them.

The keyword "continue" just means that another filter (with lower
priority, i.e. a higher prio value) is checked. As an alternative
you can also drop packets which exceed a given rate - but I don't
think that you want to do this.

I also haven't used policers within egress qdiscs, yet. You can
try to use them within an ingress qdisc as shown in the diffserv
examples which come with the "iproute2" package (i.e. you can 
police and filter the traffic at ingress side (which causes 
setting the "skb->tc_index") and then you can use the "TCINDEX"
classifier to put the packets into the according classes of your
DSMARK qdisc at egress side). 

HTH,
Steffen
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] Please check the follow script for diffserv

2003-08-15 Thread Steffen Moser
Hi,

* On Thu, Aug 14, 2003 at 02:31 PM (+0530), Raghuveer wrote:

> How can I get the real NIC bandwidth for a particular interface through 
> a script or code??

I suppose, the output of "ifconfig" does not tell the real bandwidth
correctly. So if you've got an Ethernet device you can try to use
"mii-diag", which can be found at:

  http://www.scyld.com/diag

If you want to estimate the real bandwidth of an ADSL (e.g. PPP over
Ethernet) connection it will be much difficult, because you cannot
determine the real speed which is mostly limited by your ISP's settings 
at their edge router. 

HTH,
Steffen
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] Mixing classifiers

2003-08-14 Thread Steffen Moser
Hi Marton,

* On Wed, Aug 13, 2003 at 05:44 AM (+0300), Marton Sandor wrote:

> I tried using under a htb qdisc u32 filter for 1 class , and fw 
> classifier for another but i get "RTNETLINK answers: Invalid argument" 
> when i wanr ro insert the second type of classifier. 

I don't get any error messages when starting a script like this one:

  #!/bin/bash

  TC=./tc
  DEV=eth0
  LAN=192.168.1.0/24

  $TC qdisc del dev $DEV root
  $TC qdisc add dev $DEV root handle 1:0 htb

  $TC class add dev $DEV parent 1:0 classid 1:1 htb rate 2048kbit
  $TC class add dev $DEV parent 1:0 classid 1:2 htb rate 4096kbit

  $TC filter add dev $DEV parent 1:0 protocol ip prio 1 u32 match ip dst $LAN classid 
1:1
  $TC filter add dev $DEV parent 1:0 protocol ip prio 2 handle 5 fw classid 1:2

> Using either u32 alone or fw alone work, so can't be a kernel or tc 
> problem (2.4.21-ac1, tc with htb patch). 

Here: "linux-2.4.21", tc binary which is available within [1].

> Looks like isn't allowed to mix different classifiers under the same 
> qdisc , but i didn't find any reference to this in the man pages, or 
> in the howto. Can somebody confirm this behaviour and/or explain?

At least here it seems to function. Stupid question: Are you sure that 
your kernel supports the "fw" classifier?

Bye,
Steffen

[1] http://luxik.cdi.cz/~devik/qos/htb/v3/htb3.6-020525.tgz
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] Please check the follow script for diffserv

2003-08-14 Thread Steffen Moser
Hi,

* On Thu, Aug 07, 2003 at 04:29 PM (+0800), anzp wrote:

> My linux host has two 100M eth device, but I want to limit it's 
> bandwidth to 1M for experiments. Then allocate 150k to EF flow, 
> 500k to best effort flow.
>
> The script is fllowing:
> -
>  #/bin/sh
> 
> DEV="dev eth0"
> echo $DEV
> TC="/usr/src/redhat/SOURCES/iproute2-2.4.7src/iproute2/tc/tc"
> $TC qdisc add $DEV handle 1:0 root dsmark indices 64 set_tc_index
> $TC filter add $DEV parent 1:0 protocol ip prio 1 tcindex mask 0xfc shift 2
> $TC qdisc add $DEV parent 1:0 handle 2:0 cbq bandwidth 1Mbit cell 8 avpkt 1000 mpu 64

Here, you should specify the physical bandwidth of your underlaying
device (eth0), i.e. 100Mbit. You can't slow down the device at this
position.

> $TC class add $DEV parent 2:0 classid 2:1 cbq bandwidth 1Mbit rate 150Kbit avpkt 500 
> prio 1 bounded isolated allot 1514 weight 1 max
> burst 10 
> $TC qdisc add $DEV parent 2:1 pfifo limit 5
> $TC filter add $DEV parent 2:0 protocol ip prio 1 handle 0x2e tcindex classid 2:1 
> pass_on
> #BE class(2:2) 
> $TC class add $DEV parent 2:0 classid 2:2 cbq bandwidth 1Mbit rate 500Kbit avpkt 
> 1000 prio 7 allot 1514 weight 1 maxburst 21 borrow 
> split 2:0 defmap 0x 
> $TC qdisc add $DEV parent 2:2 red limit 10KB min 1KB max 8KB burst 4 avpkt 1000 
> bandwidth 1Mbit probability 0.4
> $TC filter add $DEV parent 2:0 protocol ip prio 2 handle 0 tcindex mask 0 classid 
> 2:2 pass_on
> --
> 
> But I can download file from it with 40M speed. Why the limit is invalid?

Altough you set a maximum rate of 500Kbit for the BE class, this class
borrowed additional bandwidth, of course, not from your EF class (which
is isolated), but from the parent qdisc, which offers 100Mbit (because 
the underlaying device offers that much).

But, if changing the keyword "borrow" to "bounded" within your BE class,
the BE class would only be using 500Kbit, even if the EF class is empty. 

So, I've added one more class to your script - so my resulting script is:

  ---8<--8<--8<--8<--8<--8<--8<--8<---

  # Deleting old root qdisc 
  #
  $TC qdisc del $DEV root

  # Setting up DSMARK qdisc to copy DSCP to "skb->tc_index"
  #
  $TC qdisc add $DEV handle 1:0 root dsmark indices 64 set_tc_index

  # Setting up filter to mask out ECN bits and to extract DSCP
  #
  $TC filter add $DEV parent 1:0 protocol ip prio 1 tcindex mask 0xfc shift 2

  # Setting up inner CBQ disc
  #
  $TC qdisc add $DEV parent 1:0 handle 2:0 cbq bandwidth 100Mbit cell 8 avpkt 1000 mpu 
64

# Setting up a new class to restrict over all bandwidth to 1Mbit
#
$TC class add $DEV parent 2:0 classid 2:1 cbq bandwidth 100Mbit rate 1Mbit avpkt 
1000 \ 
prio 1 bounded isolated allot 1514 weight 1 maxburst 21

   # EF class (2:2)
   #
   $TC class add $DEV parent 2:1 classid 2:2 cbq bandwidth 1Mbit rate 150Kbit 
avpkt 500 \ 
   prio 1 bounded isolated allot 1514 weight 1 maxburst 10

  # Packets within EF class are stored in a simple classless PFIFO qdisc
  #
  $TC qdisc add $DEV parent 2:2 pfifo limit 5

# Adding filter
#
$TC filter add $DEV parent 2:0 protocol ip prio 1 handle 0x2e tcindex classid 2:2 
pass_on

   # BE class (2:3)
   #
   $TC class add $DEV parent 2:1 classid 2:3 cbq bandwidth 1Mbit rate 500Kbit 
avpkt 1000 \
   prio 7 allot 1514 weight 1 maxburst 21 borrow split 2:1 defmap 0x

  # Packets within BE class are stored in a classless RED qdisc
  #
  $TC qdisc add $DEV parent 2:3 red limit 10KB min 1KB max 8KB burst 4 avpkt 
1000 \ 
  bandwidth 1Mbit probability 0.4

# Adding filter
#
$TC filter add $DEV parent 2:0 protocol ip prio 2 handle 0 tcindex mask 0 classid 
2:3 pass_on

---8<--8<--8<--8<--8<--8<--8<--8<---


I don't know if this way is the smartest one. But, I think it may be
able to help you with your Diffserv configuration. I hope that one 
of the tc gurus will correct me if I am totally wrong. 

Best regards,
Steffen
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] Luser seeks tc syntax clue

2003-08-14 Thread Steffen Moser
Hi!

* On Tue, Aug 05, 2003 at 08:05 PM (+0100), Richard Lamont wrote:

> I'm trying to set a box up that rate limits everything sent to the
> outside world, but not limit stuff to my own LAN, using tbf.

> I don't really understand what I'm doing, and I could do with some
> help to make this script work.

I am not an expert within "tc", so some other user most probably will
correct me...

> ---8<--
> #!/bin/bash
> 
> DEV=eth0
> LAN=192.168.1.0/24
> RATE=200kbit
> LIMIT=1
> BURST=22000
> 
> # Clear out old settings
> tc qdisc del dev $DEV root
> tc qdisc del dev $DEV ingress
> 
> # Start loading new stuff
> tc qdisc add dev $DEV root handle 1: prio

This creates the root qdisc (prio). It also creates implicitly three 
classes (1:1, 1:2 and 1:3) within this qdisc.

> # Stuff addressed to LAN goes straight through
> tc qdisc add dev $DEV parent 1:1 handle 10: prio

I think a simple classless qdisc would be enough here (e.g. "pfifo" or
"sfq"), I don't know why you need another classful qdisc.

> # Stuff addressed to big wide world gets shaped
> tc qdisc add dev $DEV parent 1:2 handle 20: tbf limit $LIMIT burst $BURST rate $RATE

Now, two (1:1 and 1:2) of the three implicitly created classes are filled 
with classless qdiscs.

> # Filter on LAN destination address
> tc filter add dev $DEV parent 10: protocol ip u32 match ip src $LAN flowid 1:1

The filter rule must be assigned as a child of the outer qdisc (1:).

Further, you should use "dst" instead of "src" as you want to filter
using the destination address given within the IP header.

I think, something like:

  tc filter add dev $DEV parent 1: protocol ip prio 10 u32 match ip dst $LAN flowid 1:1

should do it.

> # Default filter for everything else
> tc filter add dev $DEV parent 20: protocol ip flowid 1:2

Here, the same thing: the filter should be a child of "1:" and the
classifier (e.g. "u32") is not specified.

To match all kind of traffic I would suggest to set up something like 
this:

  tc filter add dev $DEV parent 1: protocol ip prio 15 u32 match ip dst 0.0.0.0/0 
flowid 1:2

Using the priorities, the first filter rule (prio 10) is used at first,
so traffic which is going to $LAN will be put into class 1:1. If the
traffic was not put into class 1:1 (because it is not going to $LAN),
the second filter rule (prio 15) will be applied, and the traffic will 
be put into class 1:2, which contains the classless TBF (which uses 
the bandwidth limits).

> When I run this script, it says:
> 
> RTNETLINK answers: No such file or directory
> Unknown filter "flowid", hence option "1:2" is unparsable

The error message is probably produced because you didn't give a known
filter, like "u32", "fw", "tcindex", and so on.

> Any help gratefully received. TIA.

I hope that I could help you a little bit. As I stated above, I am quite
new to the traffic control matter.

Best Regards,
Steffen
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


[LARTC] Little bug in LARTC-HOWTO, chapter 12.4?

2003-08-07 Thread Steffen Moser
Hi all,

I've just read chapter 12.4 of the LARTC-HOWTO:

  http://www.lartc.org/howto/lartc.adv-filter.hashing.html

As I am quite new to the whole matter, I was a little bit confused about
the lines given on the upper part of chapter 12.4, because it seems that
the classifier's name was forgotten:

   # tc filter add dev eth1 parent 1:0 protocol ip prio 100 match ip src 1.2.0.0 
classid 1:1
   # tc filter add dev eth1 parent 1:0 protocol ip prio 100 match ip src 1.2.0.1 
classid 1:1
   

I think these rules would make more sense when adding the used classifier
name (most probably "u32"):

   # tc filter add dev eth1 parent 1:0 protocol ip prio 100 u32 match ip src 1.2.0.0 
classid 1:1
   # tc filter add dev eth1 parent 1:0 protocol ip prio 100 u32 match ip src 1.2.0.1 
classid 1:1
   

Also the alternating usage of "classid" (upper part of 12.4) and 
"flowid" (lower part of 12.4 and other chapters) confused me at 
first. But after looking at tc's source code it seems that both 
keywords do exactly the same thing in combination with filters. 

Is this assumption correct?

Bye,
Steffen
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/