From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Svetozar Mihailov" Date: Tue, 22 Jun 2004 19:07:12 +0000 Subject: [LARTC] htb filter Message-Id: <00b701c4588c$d4bb58d0$17009252@skknet.net> MIME-Version: 1 Content-Type: multipart/mixed; boundary="----=_NextPart_000_00B0_01C458A5.455DCD80" List-Id: To: lartc@vger.kernel.org This is a multi-part message in MIME format. ------=_NextPart_000_00B0_01C458A5.455DCD80 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: quoted-printable Hello, I have wrote some scripts to shape about 1000 workstations.=20 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 =20 # 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.=20 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" = =3D> "fh 801::" and "parent 2:40" =3D> "fh 802::".=20 What I'm missing? Regards, Svetozar ------=_NextPart_000_00B0_01C458A5.455DCD80 Content-Type: text/html; charset="koi8-r" Content-Transfer-Encoding: quoted-printable
Hello,
 
I have wrote some scripts to shape = about 1000=20 workstations.
My config:
Pentium IV - 2GHz, 1Gb RAM, RedHat = Enterprise=20 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=20 troubles with showing running configuration.
 
# Init shaper root for dev = eth0
tc qdisc add dev eth0 root handle 2: = htb default=20 200
# Default shaper for dev eth0
tc class add dev eth0 parent 2:0 = classid=20 2:200 htb rate 100Mbit prio 10
tc qdisc add dev eth0 parent 2:200 sfq = perturb=20 10
# Init NET1 shaper for dev eth0 , = rate 30Mbit=20 , ceil 40Mbit
tc class add dev eth0 parent 2:0 classid  = 2:30  htb=20 rate 30Mbit ceil 40Mbit prio 1
tc qdisc add dev eth0 parent  = 2:30 =20 sfq perturb 10
tc filter add dev eth0 parent 2:0 protocol ip prio 1 = u32 match=20 ip src 192.168.1.0/24 flowid  2:30
# Init NET2 shaper for dev eth0 , = rate 30Mbit=20 , ceil 40Mbit
tc class add dev eth0 parent 2:0 classid  = 2:40  htb=20 rate 30Mbit ceil 40Mbit prio 1
tc qdisc add dev eth0 parent  = 2:40 =20 sfq perturb 10
tc filter add dev eth0 parent 2:0 protocol ip prio 1 = u32 match=20 ip src 192.168.2.0/24 flowid  2:40
 
# User 1 - NET1
tc class add dev eth0 parent  = 2:30 =20 classid 2:1001 htb rate 32Kbit ceil 256Kbit quantum 1514
tc qdisc add = dev=20 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=20 2:1001
# User 1 - NET2
tc class add dev eth0 parent  = 2:40 =20 classid 2:2001 htb rate 32Kbit ceil 256Kbit quantum 1514
tc qdisc add = dev=20 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=20 2:2001
 
# User 2 - NET1
tc class add dev eth0 parent  = 2:30 =20 classid 2:1002 htb rate 32Kbit ceil 256Kbit quantum 1514
tc qdisc add = dev=20 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=20 2:1002
# User 2 - NET2
tc class add dev eth0 parent  = 2:40 =20 classid 2:2002 htb rate 32Kbit ceil 256Kbit quantum 1514
tc qdisc add = dev=20 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=20 2:2002
 
At this point everything work fine, both User 1 and User 2 can get = close to=20 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=20 u32
filter parent 2: protocol ip pref 1 u32 fh 802: ht divisor = 1
filter=20 parent 2: protocol ip pref 1 u32 fh 802::800 order 2048 key ht 802 bkt 0 = flowid=20 2:2001
  match c0a80001/ffffffff at 16
filter parent 2: = protocol ip=20 pref 1 u32 fh 802::801 order 2049 key ht 802 bkt 0 flowid = 2:2002
  match=20 c0a80002/ffffffff at 16
filter parent 2: protocol ip pref 1 u32 fh = 801: ht=20 divisor 1
filter parent 2: protocol ip pref 1 u32 fh 801::800 order = 2048 key=20 ht 801 bkt 0 flowid 2:1001
  match c0a80001/ffffffff at = 16
filter=20 parent 2: protocol ip pref 1 u32 fh 801::801 order 2049 key ht 801 bkt 0 = flowid=20 2:1002
  match c0a80002/ffffffff at 16
filter parent 2: = protocol ip=20 pref 1 u32 fh 800: ht divisor 1
filter parent 2: protocol ip pref 1 = u32 fh=20 800::800 order 2048 key ht 800 bkt 0 flowid 2:30
  match=20 c0a80100/ffffff00 at 12
filter parent 2: protocol ip pref 1 u32 fh = 800::801=20 order 2049 key ht 800 bkt 0 flowid 2:40
  match = c0a80200/ffffff00 at=20 12
It's look like ALL filters are attached to root class 2: which is = not true,=20 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=20 u32
filter protocol ip pref 1 u32 fh 802: ht divisor 1
filter = protocol ip=20 pref 1 u32 fh 802::800 order 2048 key ht 802 bkt 0 flowid = 2:2001
  match=20 c0a80001/ffffffff at 16
filter protocol ip pref 1 u32 fh 802::801 = order 2049=20 key ht 802 bkt 0 flowid 2:2002
  match c0a80002/ffffffff at = 16
filter=20 protocol ip pref 1 u32 fh 801: ht divisor 1
filter protocol ip pref 1 = u32 fh=20 801::800 order 2048 key ht 801 bkt 0 flowid 2:1001
  match=20 c0a80001/ffffffff at 16
filter protocol ip pref 1 u32 fh 801::801 = order 2049=20 key ht 801 bkt 0 flowid 2:1002
  match c0a80002/ffffffff at = 16
filter=20 protocol ip pref 1 u32 fh 800: ht divisor 1
filter protocol ip pref 1 = u32 fh=20 800::800 order 2048 key ht 800 bkt 0 flowid 2:30
  match=20 c0a80100/ffffff00 at 12
filter protocol ip pref 1 u32 fh 800::801 = order 2049=20 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=20 divisor 1
filter protocol ip pref 1 u32 fh 802::800 order 2048 key ht = 802 bkt=20 0 flowid 2:2001
  match c0a80001/ffffffff at 16
filter = protocol ip=20 pref 1 u32 fh 802::801 order 2049 key ht 802 bkt 0 flowid = 2:2002
  match=20 c0a80002/ffffffff at 16
filter protocol ip pref 1 u32 fh 801: ht = divisor=20 1
filter protocol ip pref 1 u32 fh 801::800 order 2048 key ht 801 bkt = 0=20 flowid 2:1001
  match c0a80001/ffffffff at 16
filter protocol = ip pref=20 1 u32 fh 801::801 order 2049 key ht 801 bkt 0 flowid 2:1002
  = match=20 c0a80002/ffffffff at 16
filter protocol ip pref 1 u32 fh 800: ht = divisor=20 1
filter protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt = 0=20 flowid 2:30
  match c0a80100/ffffff00 at 12
filter protocol = ip pref 1=20 u32 fh 800::801 order 2049 key ht 800 bkt 0 flowid 2:40
  match=20 c0a80200/ffffff00 at 12
 
I read in lartc.org that filter can be attached to any class, not = only to=20 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=20 between "parent 2:0" and "fh 800::". Logicaly "parent 2:30" =3D> "fh = 801::" and=20 "parent 2:40" =3D> "fh 802::". 
 
What I'm missing?
 
Regards,
Svetozar

 
 

------=_NextPart_000_00B0_01C458A5.455DCD80-- _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/