Linux Advanced Routing and Traffic Control list
 help / color / mirror / Atom feed
From: "Svetozar Mihailov" <lartc@pro-technica.com>
To: lartc@vger.kernel.org
Subject: [LARTC] htb filter
Date: Tue, 22 Jun 2004 19:07:12 +0000	[thread overview]
Message-ID: <00b701c4588c$d4bb58d0$17009252@skknet.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 5938 bytes --]

Hello,

I have wrote some scripts to shape about 1000 workstations. 
My config:
Pentium IV - 2GHz, 1Gb RAM, RedHat Enterprise Advanced Server 3, kernel 2.4.21-9.EL, iproute-2.4.7-11.30E.1
2 Gigabit Lan cards in bridge mode.

I use htb. Everything work fine, but I have troubles with showing running configuration.

# Init shaper root for dev eth0
tc qdisc add dev eth0 root handle 2: htb default 200
# Default shaper for dev eth0
tc class add dev eth0 parent 2:0 classid 2:200 htb rate 100Mbit prio 10
tc qdisc add dev eth0 parent 2:200 sfq perturb 10
 
# Init NET1 shaper for dev eth0 , rate 30Mbit , ceil 40Mbit
tc class add dev eth0 parent 2:0 classid  2:30  htb rate 30Mbit ceil 40Mbit prio 1
tc qdisc add dev eth0 parent  2:30  sfq perturb 10
tc filter add dev eth0 parent 2:0 protocol ip prio 1 u32 match ip src 192.168.1.0/24 flowid  2:30

# Init NET2 shaper for dev eth0 , rate 30Mbit , ceil 40Mbit
tc class add dev eth0 parent 2:0 classid  2:40  htb rate 30Mbit ceil 40Mbit prio 1
tc qdisc add dev eth0 parent  2:40  sfq perturb 10
tc filter add dev eth0 parent 2:0 protocol ip prio 1 u32 match ip src 192.168.2.0/24 flowid  2:40

# User 1 - NET1
tc class add dev eth0 parent  2:30  classid 2:1001 htb rate 32Kbit ceil 256Kbit quantum 1514
tc qdisc add dev eth0 parent 2:1001 sfq perturb 10
tc filter add dev eth0 parent  2:30  protocol ip prio 1 u32 match ip dst 192.168.0.1/32 flowid 2:1001
# User 1 - NET2
tc class add dev eth0 parent  2:40  classid 2:2001 htb rate 32Kbit ceil 256Kbit quantum 1514
tc qdisc add dev eth0 parent 2:2001 sfq perturb 10
tc filter add dev eth0 parent  2:40  protocol ip prio 1 u32 match ip dst 192.168.0.1/32 flowid 2:2001

# User 2 - NET1
tc class add dev eth0 parent  2:30  classid 2:1002 htb rate 32Kbit ceil 256Kbit quantum 1514
tc qdisc add dev eth0 parent 2:1002 sfq perturb 10
tc filter add dev eth0 parent  2:30  protocol ip prio 1 u32 match ip dst 192.168.0.2/32 flowid 2:1002
# User 2 - NET2
tc class add dev eth0 parent  2:40  classid 2:2002 htb rate 32Kbit ceil 256Kbit quantum 1514
tc qdisc add dev eth0 parent 2:2002 sfq perturb 10
tc filter add dev eth0 parent  2:40  protocol ip prio 1 u32 match ip dst 192.168.0.2/32 flowid 2:2002

At this point everything work fine, both User 1 and User 2 can get close to 256kbit from both networks in same time.
But when I try to show filters I get:

# tc filter ls dev eth0
filter parent 2: protocol ip pref 1 u32
filter parent 2: protocol ip pref 1 u32 fh 802: ht divisor 1
filter parent 2: protocol ip pref 1 u32 fh 802::800 order 2048 key ht 802 bkt 0 flowid 2:2001
  match c0a80001/ffffffff at 16
filter parent 2: protocol ip pref 1 u32 fh 802::801 order 2049 key ht 802 bkt 0 flowid 2:2002
  match c0a80002/ffffffff at 16
filter parent 2: protocol ip pref 1 u32 fh 801: ht divisor 1
filter parent 2: protocol ip pref 1 u32 fh 801::800 order 2048 key ht 801 bkt 0 flowid 2:1001
  match c0a80001/ffffffff at 16
filter parent 2: protocol ip pref 1 u32 fh 801::801 order 2049 key ht 801 bkt 0 flowid 2:1002
  match c0a80002/ffffffff at 16
filter parent 2: protocol ip pref 1 u32 fh 800: ht divisor 1
filter parent 2: protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 2:30
  match c0a80100/ffffff00 at 12
filter parent 2: protocol ip pref 1 u32 fh 800::801 order 2049 key ht 800 bkt 0 flowid 2:40
  match c0a80200/ffffff00 at 12

It's look like ALL filters are attached to root class 2: which is not true, becouse all work as expected. 
If I try to specify classid in tc result is:

#tc filter ls dev eth0 parent 2:30
filter protocol ip pref 1 u32
filter protocol ip pref 1 u32 fh 802: ht divisor 1
filter protocol ip pref 1 u32 fh 802::800 order 2048 key ht 802 bkt 0 flowid 2:2001
  match c0a80001/ffffffff at 16
filter protocol ip pref 1 u32 fh 802::801 order 2049 key ht 802 bkt 0 flowid 2:2002
  match c0a80002/ffffffff at 16
filter protocol ip pref 1 u32 fh 801: ht divisor 1
filter protocol ip pref 1 u32 fh 801::800 order 2048 key ht 801 bkt 0 flowid 2:1001
  match c0a80001/ffffffff at 16
filter protocol ip pref 1 u32 fh 801::801 order 2049 key ht 801 bkt 0 flowid 2:1002
  match c0a80002/ffffffff at 16
filter protocol ip pref 1 u32 fh 800: ht divisor 1
filter protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 2:30
  match c0a80100/ffffff00 at 12
filter protocol ip pref 1 u32 fh 800::801 order 2049 key ht 800 bkt 0 flowid 2:40
  match c0a80200/ffffff00 at 12

"parent" is disapearing from list, but I see ALL attached filters.

If I try to see 2:40 class result is exactly the same:

#tc filter ls dev eth0 parent 2:40
filter protocol ip pref 1 u32
filter protocol ip pref 1 u32 fh 802: ht divisor 1
filter protocol ip pref 1 u32 fh 802::800 order 2048 key ht 802 bkt 0 flowid 2:2001
  match c0a80001/ffffffff at 16
filter protocol ip pref 1 u32 fh 802::801 order 2049 key ht 802 bkt 0 flowid 2:2002
  match c0a80002/ffffffff at 16
filter protocol ip pref 1 u32 fh 801: ht divisor 1
filter protocol ip pref 1 u32 fh 801::800 order 2048 key ht 801 bkt 0 flowid 2:1001
  match c0a80001/ffffffff at 16
filter protocol ip pref 1 u32 fh 801::801 order 2049 key ht 801 bkt 0 flowid 2:1002
  match c0a80002/ffffffff at 16
filter protocol ip pref 1 u32 fh 800: ht divisor 1
filter protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 2:30
  match c0a80100/ffffff00 at 12
filter protocol ip pref 1 u32 fh 800::801 order 2049 key ht 800 bkt 0 flowid 2:40
  match c0a80200/ffffff00 at 12


I read in lartc.org that filter can be attached to any class, not only to root. I make my traffic control acording to that. And everything is fine.
I see thah filters are grouped. There is "fh 800::", but where is relation between "parent 2:0" and "fh 800::". Logicaly "parent 2:30" => "fh 801::" and "parent 2:40" => "fh 802::". 

What I'm missing?

Regards,
Svetozar





[-- Attachment #2: Type: text/html, Size: 8341 bytes --]

             reply	other threads:[~2004-06-22 19:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-22 19:07 Svetozar Mihailov [this message]
2004-06-22 21:41 ` [LARTC] htb filter Ed Wildgoose
2004-06-23  5:57 ` Svetozar Mihailov
2004-06-23  6:08 ` Jason Boxman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='00b701c4588c$d4bb58d0$17009252@skknet.net' \
    --to=lartc@pro-technica.com \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox