htb filter
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
Shouldn't this:
Quoted 2 lines
tc class add dev eth0 parent 2:0 classid 2:200 htb rate 100Mbit prio 10
be "parent 2:"?
Ed W
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Quoted 10 lines
Shouldn't this:
Quoted 2 lines
tc class add dev eth0 parent 2:0 classid 2:200 htb rate 100Mbit prio 10
be "parent 2:"?
Ed W
That change nothing. I have running system with 800 PC , 4 classes for each. There is no difference for me in using "parent 2:" vs "parent 2:0". Both give same result.
Svetozar.
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Quoted 10 lines · Svetozar Mihailov
Quoted 6 lines
Shouldn't this:
Quoted 1 line
tc class add dev eth0 parent 2:0 classid 2:200 htb rate 100Mbit prio 10
be "parent 2:"?
Ed W
That change nothing. I have running system with 800 PC , 4 classes for each. There is no difference for me in using "parent 2:" vs "parent 2:0". Both give same result.
Exactly. 2: is simply a short hand for 2:0, for example.
Signature · 8 lines
Jason Boxman Perl Programmer / *NIX Systems Administrator Shimberg Center for Affordable Housing | University of Florida http://edseek.com/ - Linux and FOSS stuff _______________________________________________ LARTC mailing list / [email protected] http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/