Skip to contentSkip to conversation

Question on TC filter

LARTC Cheng Kwok Wing, William 2 participants 5 messages Jan 10, 2003 – Jan 11, 2003

lore
Share & tools
lore
#0 lore raw

Hi,

I want work out a GUI interface for htb and now here comes to the part about adding and removing classes and filters.

Here is an example script.
TC="tc"
DEV="dev eth1"

echo "Add root qdisc, default traffic go to 1:30" $TC qdisc add $DEV root handle 1: htb default 30

echo "Divide the traffic into different classes and levels"
# -------- level 1 --------
$TC class add $DEV parent 1: classid 1:1 htb rate 100mbit burst 15k
# -------- level 2 --------
$TC class add $DEV parent 1:1 classid 1:10 htb rate 400kbit ceil 600kbit burst 10m
$TC class add $DEV parent 1:1 classid 1:20 htb rate 1mbit ceil 1.5mbit burst 1m

echo "SFQ for beneath these classes:"
$TC qdisc add $DEV parent 1:10 handle 10: sfq perturb 10
$TC qdisc add $DEV parent 1:20 handle 20: sfq perturb 10

echo "Add the filters which direct traffic to the right classes:"
tc filter add $DEV parent 1: protocol ip u32 match ip dst 192.168.0.2/32 flowid 1:10
tc filter add $DEV parent 1: protocol ip u32 match ip dst 192.168.0.3/32 flowid 1:20

Suppose I want to remove the class 1:20. What should I do? I need to first remove the filters with flowid 1:20, but how can I remove it independently??? If I run "tc filter del $DEV parent 1:0......", then all filters will be removed. Any suggestion on how to solve this problem or a better way to organise the classes or filters??

Thanks in advance,
William

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw
Quoted 5 lines · William

Hi,

I want work out a GUI interface for htb and now here comes to the part about adding and removing classes and filters.

Like I do :à
http://home.docum.org/qos/

Quoted 7 lines

Suppose I want to remove the class 1:20. What should I do? I need to first remove the filters with flowid 1:20, but how can I remove it independently??? If I run "tc filter del $DEV parent 1:0......", then all filters will be removed. Any suggestion on how to solve this problem or a better way to organise the classes or filters??

I create all rules, generate the tc script, execute the script. So no changing of running classes and filters. I don't think you can delete 1 filter like you want.

Stef

Signature · 8 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#2 lore raw
In reply to Cheng Kwok Wing, William

Thanks for your reply. I've visited your web
http://home.docum.org/qos/ already. I just wonder if there are some better ways to add and remove class one by one rather than writing the script all the time.

Wing

Quoted 22 lines · --- Stef Coene
Quoted 3 lines · William

Hi,

I want work out a GUI interface for htb and now

here

Quoted 1 line

comes to the part about adding and removing

classes

Quoted 1 line

and filters.

Like I do :?> http://home.docum.org/qos/

Quoted 1 line

Suppose I want to remove the class 1:20. What

should I

Quoted 3 lines

do? I need to first remove the filters with flowid 1:20, but how can I remove it independently??? If I run "tc filter del $DEV parent 1:0......",

then

Quoted 1 line

all filters will be removed. Any suggestion on how

to

Quoted 2 lines

solve this problem or a better way to organise the classes or filters??

Quoted 15 lines

I create all rules, generate the tc script, execute the script. So no
changing of running classes and filters. I don't think you can delete 1
filter like you want.

Stef

Signature · 4 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#3 lore raw
In reply to Cheng Kwok Wing, William

Thanks for your reply. I've visited your web
http://home.docum.org/qos/ already. I just wonder if there are some better ways to add and remove class one by one rather than writing the script all the time.

In addition, each time your run the tc script. You need to remove the root qdisc, i.e. clear all setting, first. Then, all counters are reset......... How to solve such problem if I want to dump the data from "tc -s -d class dev eth1" and plot graph using rrdtools (without losing previous data)??

Wing

Quoted 22 lines · --- Stef Coene
Quoted 3 lines · William

Hi,

I want work out a GUI interface for htb and now

here

Quoted 1 line

comes to the part about adding and removing

classes

Quoted 1 line

and filters.

Like I do :?> http://home.docum.org/qos/

Quoted 1 line

Suppose I want to remove the class 1:20. What

should I

Quoted 3 lines

do? I need to first remove the filters with flowid 1:20, but how can I remove it independently??? If I run "tc filter del $DEV parent 1:0......",

then

Quoted 1 line

all filters will be removed. Any suggestion on how

to

Quoted 2 lines

solve this problem or a better way to organise the classes or filters??

Quoted 15 lines

I create all rules, generate the tc script, execute the script. So no
changing of running classes and filters. I don't think you can delete 1
filter like you want.

Stef

Signature · 4 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#4 lore raw
In reply to Cheng Kwok Wing, William
Quoted 11 lines · William

Thanks for your reply. I've visited your web
http://home.docum.org/qos/ already. I just wonder if there are some better ways to add and remove class one by one rather than writing the script all the time.

In addition, each time your run the tc script. You need to remove the root qdisc, i.e. clear all setting, first. Then, all counters are reset......... How to solve such problem if I want to dump the data from "tc -s -d class dev eth1" and plot graph using rrdtools (without losing previous data)??

rrdtool is smart enough to understand what happens. It stores the difference between 2 updates and a negative update is not possible. So that update is ignored. But that's hardly visible on a graph.
So restting the counters is no problem if you use rrdtool to store the data.

Stef

Signature · 8 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/