Skip to contentSkip to conversation

How to do ensure bandwith

LARTC liang jian 2 participants 12 messages Mar 24, 2003 – Apr 3, 2003

lore
Share & tools
lore

liang jian

author
#0 lore raw

How to do ensure a class not lended and not borrowed each other.

I do cburst burst 0b ,but ctokens tokens go to negative!

---------------------------------
Do You Yahoo!?
"更多惊喜,同样精彩,NetVista A30 热卖"

#1 lore raw
Quoted 1 line · liang jian

How to do ensure a class not lended and not borrowed each other.

That also depends on the setup of the other classes. Can you give us more information like htb or cbq? What do you want to do? What have you tried so far?

Quoted 1 line

I do cburst burst 0b ,but ctokens tokens go to negative!

You always needs a minimum burst and cburst. If you use htb and if you don't specify it on the command line, htb will calculate it for you.

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/
author
#2 lore raw
In reply to liang jian

Htb tree:

                      20:1
       20:10                 20:11

20:200 20:201 20:210 20:211
http stream ensure 4Mbps
ftp stream ensure 2Mbps
smtp stream ensure 2MMbps
other stream ensure 2Mbps
so I want ensure 20:200 have 4Mbps for http
20:201 have 2Mbps for ftp and 20:210 have 2Mbps for smtp 20:211 have 2Mbps for other stream(default class )
Each class don't permit lended or borrowed bandwith from each other. This is I want to get.

Quoted 6 lines
Quoted 1 line · liang jian

How to do ensure a class not lended and not borrowed each other.

That also depends on the setup of the other classes. Can you give us >more information like htb or cbq? What do you want to do? What have you tried >so far?

Quoted 13 lines

I do cburst burst 0b ,but ctokens tokens go to negative!
You always needs a minimum burst and cburst. If you use htb and if you >don't specify it on the command line, htb will calculate it for you.

Stef

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

---------------------------------
Do You Yahoo!?
"更多惊喜,同样精彩,NetVista A30 热卖"

#3 lore raw
In reply to liang jian
Quoted 13 lines · liang jian

Htb tree:

                      20:1
       20:10                 20:11

20:200 20:201 20:210 20:211
http stream ensure 4Mbps
ftp stream ensure 2Mbps
smtp stream ensure 2MMbps
other stream ensure 2Mbps
so I want ensure 20:200 have 4Mbps for http
20:201 have 2Mbps for ftp and 20:210 have 2Mbps for smtp 20:211 have 2Mbps for other stream(default class )
Each class don't permit lended or borrowed bandwith from each other. This is I want to get.

Can you try to explain it a bit more?

You created 4 classes, (200, 201, 210, 211) so I suppose you want :
200 : http traffic, 4Mbps
201 : ftp traffic, 2Mbps
210 : smtp traffic, 2Mbps
211 : other trafic, 2Mbps

Each class is isolated so it never lends it unused bandwidth to other classes. And each class is never using unused bandwidth from other classes. So as example, http has 4Mbps and it never can use the bandwidth of ftp (2Mbps) if there is no ftp traffic. So the 4Mbps is a maximum bandwidth.

What's the total bandiwidth available? You have 4Mbps for http and 3x2Mbps for ftp,smtp,other. So the total bandwidth available on the link is 10Mbps?

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/
author
#4 lore raw
In reply to liang jian
Quoted 29 lines
Quoted 5 lines · liang jian

Htb tree:
20:1
20:10 20:11
20:200 20:201 20:210 20:211
http stream ensure 4Mbps

Quoted 8 lines

ftp stream ensure 2Mbps
smtp stream ensure 2MMbps
other stream ensure 2Mbps
so I want ensure 20:200 have 4Mbps for http
20:201 have 2Mbps for ftp and 20:210 have 2Mbps for smtp 20:211 have 2Mbps for other stream(default class )
Each class don't permit lended or borrowed bandwith from each other. This is I want to get.

Can you try to explain it a bit more?

You created 4 classes, (200, 201, 210, 211) so I suppose you want :
200 : http traffic, 4Mbps
201 : ftp traffic, 2Mbps
210 : smtp traffic, 2Mbps
211 : other trafic, 2Mbps

Each class is isolated so it never lends it unused bandwidth to other >classes. And each class is never using unused bandwidth from other classes. So >as example, http has 4Mbps and it never can use the bandwidth of ftp (2Mbps) if there is no ftp traffic. So the 4Mbps is a maximum bandwidth.

Quoted 11 lines

What's the total bandiwidth available? You have 4Mbps for http and >3x2Mbps for ftp,smtp,other. So the total bandwidth available on the link is 10Mbps?

Stef

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

Yes ,that is my means :),my english is poor

---------------------------------
Do You Yahoo!?
"雅虎通网络KTV, 随时随地免费卡拉OK~~"

#5 lore raw
In reply to liang jian
Quoted 37 lines · liang jian
Quoted 37 lines

Stef Coene <[email protected]> wrote:>On Tuesday 25 March 2003 03:18,

Quoted 5 lines · liang jian

Htb tree:
20:1
20:10 20:11
20:200 20:201 20:210 20:211
http stream ensure 4Mbps

Quoted 8 lines

ftp stream ensure 2Mbps
smtp stream ensure 2MMbps
other stream ensure 2Mbps
so I want ensure 20:200 have 4Mbps for http
20:201 have 2Mbps for ftp and 20:210 have 2Mbps for smtp 20:211 have 2Mbps for other stream(default class )
Each class don't permit lended or borrowed bandwith from each other. This is I want to get.

Can you try to explain it a bit more?

You created 4 classes, (200, 201, 210, 211) so I suppose you want :
200 : http traffic, 4Mbps
201 : ftp traffic, 2Mbps
210 : smtp traffic, 2Mbps
211 : other trafic, 2Mbps

Each class is isolated so it never lends it unused bandwidth to other

Quoted 1 line

classes. And each class is never using unused bandwidth from other

classes. So >as example, http has 4Mbps and it never can use the bandwidth of ftp (2Mbps) if there is no ftp traffic. So the 4Mbps is a maximum bandwidth.

What's the total bandiwidth available? You have 4Mbps for http and

Quoted 1 line

3x2Mbps for ftp,smtp,other. So the total bandwidth available on the link

is 10Mbps?

Stef

Quoted 8 lines
Quoted 6 lines

--

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

Yes ,that is my means :),my english is poor

No problem.

I have some remarks. Why not let the 4 classes borrow unused bandwidth from each other? So if there is no other traffic then ftp, ftp can get 10Mbps. But as soone as there is some other traffic, the ftp traffic goes down.

And if you want 4 isolated classes, why not just creating the 4 classes like this :

                   20:1

20:200 20:201 20:210 20:211

You have to create the htb (or cbq) classes. FIltering the traffic and placing in the classes is easy (you can filter on ports). Except maybe for the ftp traffic because that uses dynamic ports.

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/
author
#6 lore raw
In reply to liang jian
Quoted 3 lines

Yes ,that is my means :),my english is poor

No problem.

I have some remarks. Why not let the 4 classes borrow unused bandwidth from each other? So if there is no other traffic then ftp, ftp can get 10Mbps. But as soone as there is some other traffic, the ftp traffic goes down.

And if you want 4 isolated classes, why not just creating the 4 classes like this :

20:1
20:200 20:201 20:210 20:211

You have to create the htb (or cbq) classes. FIltering the traffic and placing in the classes is easy (you can filter on ports). Except maybe for the ftp traffic because that uses dynamic ports.

Stef:
Thanks for your answer me quickly!
I have others question :)
I apologize that it will take time.
My topological look like this:
Local:192.168.1.2----------|eth0:192.168.1.1 Linux Box eth1:172.16.1.1|------Internet

I have create a default 200

             20:1 (4kbps)

200:200 200:201 200:210 200:211
(1kbps) (1kbps) (1kbps) (1kbps)

I have 10Mbps on the eth1,but I want to test htb,so I do that:
tc class add dev eth0 parent 20: classid 20:1 htb rate 4kbps ceil 4kbps

200:201 mark with 7,then
iptables -t mangle -A FORWARD -p tcp -o eth0 -s 0/0 --dport 80 -d 0/0 -j MARK --set-mark 7 iptables -t mangle -A PREROUTING -p tcp -i eth0 -s 0/0 --dport 80 -d 0/0 -j MARK --set-mark 7

why all traffic from default 200 to Internet.(the iptables rules like no use)

------------------------------------------------

If I use it on eth1 interface iptables rules work!?(though I have default class 200 but all traffice from 200:201 to Internet.) other question it that:
In this settings use Local machine 192.168.1.2 download some soft from Internet.why it rate overrun 1kbps?

Rules like this:
tc class add dev eth1 parent 20: classid 20:1 htb rate 4kbps ceil 4kbps

iptables -t mangle -A FORWARD -p tcp -o eth1 -s 0/0 --dport 80 -d 0/0 -j MARK --set-mark 7 iptables -t mangle -A PREROUTING -p tcp -i eth1 -s 0/0 --dport 80 -d 0/0 -j MARK --set-mark 7

tc can only shape outgoing traffic(My settings which is my outgoing traffic,eth1 or eth0?) Maybe I mix them I need path kernel with IMQ?

---------------------------------
Do You Yahoo!?
"雅虎通网络KTV, 随时随地免费卡拉OK~~"

author
#7 lore raw
In reply to liang jian
Quoted 12 lines
Quoted 3 lines

Yes ,that is my means :),my english is poor

No problem.

I have some remarks. Why not let the 4 classes borrow unused bandwidth from each other? So if there is no other traffic then ftp, ftp can get 10Mbps. But as soone as there is some other traffic, the ftp traffic goes down.

And if you want 4 isolated classes, why not just creating the 4 classes like this :

Quoted 6 lines

20:1
20:200 20:201 20:210 20:211

You have to create the htb (or cbq) classes. FIltering the traffic and placing in the classes is easy (you can filter on ports). Except maybe for the ftp traffic because that uses dynamic ports.

Stef:
Thanks for your answer me quickly!
I have others question :)
I apologize that it will take time.
My topological look like this:
Local:192.168.1.2----------|eth0:192.168.1.1 Linux Box eth1:172.16.1.1|------Internet

I have create a default 200

             20:1 (4kbps)

200:200 200:201 200:210 200:211
(1kbps) (1kbps) (1kbps) (1kbps)

I have 10Mbps on the eth1,but I want to test htb,so I do that:
tc class add dev eth0 parent 20: classid 20:1 htb rate 4kbps ceil 4kbps

200:201 mark with 7,then
iptables -t mangle -A FORWARD -p tcp -o eth0 -s 0/0 --dport 80 -d 0/0 -j MARK --set-mark 7 iptables -t mangle -A PREROUTING -p tcp -i eth0 -s 0/0 --dport 80 -d 0/0 -j MARK --set-mark 7

why all traffic from default 200 to Internet.(the iptables rules like no use)

------------------------------------------------

If I use it on eth1 interface iptables rules work!?(though I have default class 200 but all traffice from 200:201 to Internet.) other question it that:
In this settings use Local machine 192.168.1.2 download some soft from Internet.why it rate overrun 1kbps?

Rules like this:
tc class add dev eth1 parent 20: classid 20:1 htb rate 4kbps ceil 4kbps

iptables -t mangle -A FORWARD -p tcp -o eth1 -s 0/0 --dport 80 -d 0/0 -j MARK --set-mark 7 iptables -t mangle -A PREROUTING -p tcp -i eth1 -s 0/0 --dport 80 -d 0/0 -j MARK --set-mark 7

tc can only shape outgoing traffic(My settings which is my outgoing traffic,eth1 or eth0?) Maybe I mix them I need path kernel with IMQ?

---------------------------------
Do You Yahoo!?
"雅虎通网络KTV, 随时随地免费卡拉OK~~"

#8 lore raw
In reply to liang jian
Quoted 15 lines · liang jian
Quoted 15 lines
Quoted 1 line

Yes ,that is my means :),my english is poor

No problem.

I have some remarks. Why not let the 4 classes borrow unused bandwidth from each other? So if there is no other traffic then ftp, ftp can get 10Mbps. But as soone as there is some other traffic, the ftp traffic goes down.

And if you want 4 isolated classes, why not just creating the 4 classes like this :

20:1
20:200 20:201 20:210 20:211

Quoted 7 lines
Quoted 3 lines

You have to create the htb (or cbq) classes. FIltering the traffic and placing in the classes is easy (you can filter on ports). Except maybe for the ftp traffic because that uses dynamic ports.

Stef:
Thanks for your answer me quickly!
I have others question :)

I have some problems understanding your english. Can you post your htb and iptabels script so I can understand what you did?

Quoted 5 lines

I apologize that it will take time.
My topological look like this:
Local:192.168.1.2----------|eth0:192.168.1.1 Linux Box eth1:172.16.1.1|------Internet

Quoted 8 lines

I have create a default 200

             20:1 (4kbps)

200:200 200:201 200:210 200:211
(1kbps) (1kbps) (1kbps) (1kbps)

I have 10Mbps on the eth1,but I want to test htb,so I do that:
tc class add dev eth0 parent 20: classid 20:1 htb rate 4kbps ceil 4kbps

4 and 1 kbps is __very__ low. It's too low for htb to get some results.

Quoted 8 lines

200:201 mark with 7,then
iptables -t mangle -A FORWARD -p tcp -o eth0 -s 0/0 --dport 80 -d 0/0 -j MARK --set-mark 7
iptables -t mangle -A PREROUTING -p tcp -i eth0 -s 0/0 --dport 80 -d 0/0 -j MARK --set-mark 7

why all traffic from default 200 to Internet.(the iptables rules like no use)

So all traffic ends up in 200:200 ??
You can check with iptables -L -v -n if your iptables rules are matched. If the iptables rule match, the byte and packet counters will increase.

Quoted 7 lines

------------------------------------------------

If I use it on eth1 interface iptables rules work!?(though I have default class 200 but all traffice from 200:201 to Internet.) other question it that:
In this settings use Local machine 192.168.1.2 download some soft from Internet.why it rate overrun 1kbps?

Because 1kbps is too low for htb. And you have to mark packets in POSTROUTING. Local generated packets don't travel thru forward or prerouting. See kptd on www.docum.org.

Quoted 9 lines

Rules like this:
tc class add dev eth1 parent 20: classid 20:1 htb rate 4kbps ceil 4kbps

iptables -t mangle -A FORWARD -p tcp -o eth1 -s 0/0 --dport 80 -d 0/0 -j MARK --set-mark 7 iptables -t mangle -A PREROUTING -p tcp -i eth1 -s 0/0 --dport 80 -d 0/0 -j MARK --set-mark 7

tc can only shape outgoing traffic(My settings which is my outgoing traffic,eth1 or eth0?) Maybe I mix them I need path kernel with IMQ?

You can indeed only shape outgoing traffic. Or you need the imq device. But if you shape on eth0 and eth1 you control both directions. So you don't need the imq device.

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/
author
#9 lore raw
In reply to liang jian

hi:
Stef

Quoted 24 lines
Quoted 3 lines

Stef:
Thanks for your answer me quickly! I have others question :)

I have some problems understanding your english. Can you post your htb and iptabels script so I can understand what you did?

Quoted 17 lines

I apologize that it will take time.
My topological look like this:
Local:192.168.1.2----------|eth0:192.168.1.1 Linux Box eth1:172.16.1.1|------Internet

I have create a default 200

             20:1 (10Mbps)

20:20 20:21 20:22 20:23 20:24 (20Mbps) (20Mbps) (20Mbps) (20Mbps) (20Mbps)

20:22 mark with 3,then
iptables -t mangle -A FORWARD -p tcp -o eth0 -s 0/0 --dport 80 -d 0/0 -j MARK --set-mark 7
iptables -t mangle -A PREROUTING -p tcp -i eth0 -s 0/0 --dport 80 -d 0/0 -j MARK --set-mark 7

Quoted 3 lines
Quoted 2 lines

why all traffic from default 20 to Internet.(the iptables rules like no use)

So all traffic ends up in 20:20 ??

yes.blew my scripts.
tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 20: htb default 20
tc class add dev eth0 parent 20: classid 20:1 htb rate 10240kbps ceil 10240kbps tc class add dev eth0 parent 20:1 classid 20:20 htb rate 2048kbps ceil 2048kbps tc qdisc add dev eth0 parent 20:20 sfq
tc class add dev eth0 parent 20:1 classid 20:21 htb rate 2048kbps ceil 2048kbps tc qdisc add dev eth0 parent 20:21 sfq
tc class add dev eth0 parent 20:1 classid 20:22 htb rate 2048kbps ceil 2048kbps tc qdisc add dev eth0 parent 20:22 sfq
tc class add dev eth0 parent 20:1 classid 20:23 htb rate 2048kbps ceil 2048kbps tc qdisc add dev eth0 parent 20:23 sfq
tc class add dev eth0 parent 20:1 classid 20:24 htb rate 2048kbps ceil 2048kbps tc qdisc add dev eth0 parent 20:24 sfq
tc filter add dev eth0 parent 20: protocol ip handle 1 fw classid 20:20 tc filter add dev eth0 parent 20: protocol ip handle 2 fw classid 20:21 tc filter add dev eth0 parent 20: protocol ip handle 3 fw classid 20:22 tc filter add dev eth0 parent 20: protocol ip handle 4 fw classid 20:23 tc filter add dev eth0 parent 20: protocol ip handle 5 fw classid 20:24

iptables -t mangle -A FORWARD -p tcp -o eth0 -s 0/0 --dport 80 -d 0/0 -j MARK --set-mark 3 iptables -t mangle -A PREROUTING -p tcp -i eth0 -s 0/0 --dport 80 -d 0/0 -j MARK --set-mark 3

Quoted 2 lines

You can check with iptables -L -v -n if your iptables rules are matched. If the iptables rule match, the byte and packet counters will increase.

when I use iptable -L -v -n -t mangle,I have below infor PREROUTING chain:

 pkts bytes target     prot opt in     out     source               destination
 305 40889  MARK       tcp  --  eth0   *       0.0.0.0/0            0.0.0.0/0          tcp dpt:80 MARK set 0x3
FORWARD chain:
 pkts bytes target     prot opt in     out     source               destination
 0     0    MARK       tcp  --  *      eth0    0.0.0.0/0            0.0.0.0/0          tcp dpt:80 MARK set 0x3

why not stream through ForWard chain ? beacause this all traffic into 20:20(default class)?

---------------------------------
Do You Yahoo!?
"雅虎通网络KTV, 随时随地免费卡拉OK~~"

#10 lore raw
In reply to liang jian
Quoted 20 lines

yes.blew my scripts.
tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 20: htb default 20
tc class add dev eth0 parent 20: classid 20:1 htb rate 10240kbps ceil 10240kbps tc class add dev eth0 parent 20:1 classid 20:20 htb rate 2048kbps ceil 2048kbps tc qdisc add dev eth0 parent 20:20 sfq
tc class add dev eth0 parent 20:1 classid 20:21 htb rate 2048kbps ceil 2048kbps tc qdisc add dev eth0 parent 20:21 sfq
tc class add dev eth0 parent 20:1 classid 20:22 htb rate 2048kbps ceil 2048kbps tc qdisc add dev eth0 parent 20:22 sfq
tc class add dev eth0 parent 20:1 classid 20:23 htb rate 2048kbps ceil 2048kbps tc qdisc add dev eth0 parent 20:23 sfq
tc class add dev eth0 parent 20:1 classid 20:24 htb rate 2048kbps ceil 2048kbps tc qdisc add dev eth0 parent 20:24 sfq
tc filter add dev eth0 parent 20: protocol ip handle 1 fw classid 20:20 tc filter add dev eth0 parent 20: protocol ip handle 2 fw classid 20:21 tc filter add dev eth0 parent 20: protocol ip handle 3 fw classid 20:22 tc filter add dev eth0 parent 20: protocol ip handle 4 fw classid 20:23 tc filter add dev eth0 parent 20: protocol ip handle 5 fw classid 20:24

Quoted 3 lines

iptables -t mangle -A FORWARD -p tcp -o eth0 -s 0/0 --dport 80 -d 0/0 -j MARK --set-mark 3 iptables -t mangle -A PREROUTING -p tcp -i eth0 -s 0/0 --dport 80 -d 0/0 -j MARK --set-mark 3

Your script seems ok to me.

Quoted 11 lines
Quoted 2 lines

You can check with iptables -L -v -n if your iptables rules are matched. If the iptables rule match, the byte and packet counters will increase.

when I use iptable -L -v -n -t mangle,I have below infor PREROUTING chain:

 pkts bytes target     prot opt in     out     source              
destination 305 40889  MARK       tcp  --  eth0   *       0.0.0.0/0        
   0.0.0.0/0          tcp dpt:80 MARK set 0x3 FORWARD chain:
 pkts bytes target     prot opt in     out     source              
destination 0     0    MARK       tcp  --  *      eth0    0.0.0.0/0        

0.0.0.0/0 tcp dpt:80 MARK set 0x3

So the packets get marked.

Quoted 2 lines

why not stream through ForWard chain ? beacause this all traffic into 20:20(default class)?

I suppose you execute
tc -s -d class show dev eth0
to see the counters increase for the 20:20 class and not for the other class? If you didn't execute that command before, can you do so and check the counters for the different classes?

Stef

Signature · 7 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/
author
#11 lore raw
In reply to liang jian

hi:
Stef and everybody
I use tc with htb more than one month.
This is my Network settings
Local Network 192.168.1.0/24 ---| eth0:192.168.1.1 Linux Box eth1:172.16.1.1 | -- Internet In order to ensure bandwidth
on eth1 I have create a default 20

              20:1 (10Mbps)
 20:20 20:21 20:22 20:23 20:24
(20Mbps) (20Mbps) (20Mbps) (20Mbps) (20Mbps) 
on eth0 I have create only a default 20
    30:1 (10Mbps)

30:20
(10Mbps)
Each class is isolated so it never lends it unused bandwidth to other classes.
And each class is never using unused bandwidth from other classes.
first,eth1 and eth0 with same bandwith,I use eth1 Interface ensure totoal bandwith with 10Mbps. then I part eth1 with fine qdisc.
My script that:
tc qdisc add dev eth0 root handle 20: htb default 20
tc class add dev eth0 parent 20: classid 20:1 htb rate 10240kbps ceil 10240kbps
tc class add dev eth0 parent 20:1 classid 20:20 htb rate 10240kbps ceil 10240kbps
tc qdisc add dev eth0 parent 20:20 sfq
tc qdisc del dev eth1 root
tc qdisc add dev eth1 root handle 30: htb default 20
tc class add dev eth1 parent 30: classid 30:1 htb rate 10240kbps ceil 10240kbps
tc class add dev eth1 parent 30:1 classid 30:20 htb rate 2048kbps ceil 2048kbps
tc qdisc add dev eth1 parent 30:20 sfq
tc class add dev eth1 parent 30:1 classid 30:21 htb rate 2048kbps ceil 2048kbps
tc qdisc add dev eth1 parent 30:21 sfq
tc class add dev eth1 parent 30:1 classid 30:22 htb rate 2048kbps ceil 2048kbps
tc qdisc add dev eth1 parent 30:22 sfq
tc class add dev eth1 parent 30:1 classid 30:23 htb rate 2048kbps ceil 2048kbps
tc qdisc add dev eth1 parent 30:23 sfq
tc class add dev eth1 parent 30:1 classid 30:24 htb rate 2048kbps ceil 2048kbps
tc qdisc add dev eth1 parent 30:24 sfq
tc filter add dev eth1 parent 30: protocol ip handle 1 fw classid 30:20
tc filter add dev eth1 parent 30: protocol ip handle 2 fw classid 30:21
tc filter add dev eth1 parent 30: protocol ip handle 3 fw classid 30:22
tc filter add dev eth1 parent 30: protocol ip handle 4 fw classid 30:23
tc filter add dev eth1 parent 30: protocol ip handle 5 fw classid 30:24

iptables -t mangle -A FORWARD -p tcp -o eth1 -s 192.168.1.2/32 --dport 80 -d 202.197.240.6/32 -j MARK --set-mark 3 iptables -t mangle -A PREROUTING -p tcp -i eth1 -s 192.168.1.2/32 --dport 80 -d 202.197.240.6/32 -j MARK --set-mark 3 iptables -t mangle -A FORWARD -p tcp -o eth1 -s 192.168.1.2/32 --dport 80 -d 195.27.176.155/32 -j MARK --set-mark 4 iptables -t mangle -A PREROUTING -p tcp -i eth1 -s 192.168.1.2/32 --dport 80 -d 195.27.176.155/32 -j MARK --set-mark 4 iptables -t mangle -A FORWARD -p tcp -o eth1 -s 192.168.1.2/32 --dport 80 -d 218.104.154.19/32 -j MARK --set-mark 5 iptables -t mangle -A PREROUTING -p tcp -i eth1 -s 192.168.1.2/32 --dport 80 -d 218.104.154.19/32 -j MARK --set-mark 5

I think that all traffic must thro eth0,then it will thro eth1 of one qdisc. If my script is right ,I hope it will help newbie of tc.
If it mistake ,please everyone tell me :)

---------------------------------
Do You Yahoo!?
"雅虎通网络KTV, 随时随地免费卡拉OK~~"