Skip to contentSkip to conversation

Multiple classes

LARTC Homer Parker 2 participants 5 messages Dec 3, 2002 – Dec 4, 2002

lore
Share & tools
lore
#0 lore raw

I'm trying to implement something similar the the diagram in section
9.5.2.1 in the LARTC HOWTO, but must have missed something somewhere :( I'm trying to hack up wondershaper, as it looked like a good place to start.. Here's where I currently at, but I've tried alot of different things, all failing, some worse than others. The end result is to throttle back 126 IP's individually. I've read so much over the last few days, I've almost confused myself, and probably have ;) Thanks for any and all help!

tc qdisc add dev $DEV0 root handle 1: htb default 20

tc class add dev $DEV0 parent 1: classid 1:1 htb rate 128kbit \
burst 6k

tc class add dev $DEV0 parent 1:1 classid 2: htb rate 128kbit \
burst 6k

---
Homer Parker

http://www.homershut.net
telnet://bbs.homershut.net

#1 lore raw
Quoted 8 lines · Homer Parker

I'm trying to implement something similar the the diagram in section
9.5.2.1 in the LARTC HOWTO, but must have missed something somewhere :( I'm trying to hack up wondershaper, as it looked like a good place to start.. Here's where I currently at, but I've tried alot of different things, all failing, some worse than others. The end result is to throttle back 126 IP's individually. I've read so much over the last few days, I've almost confused myself, and probably have ;) Thanks for any and all help!

Quoted 7 lines

tc qdisc add dev $DEV0 root handle 1: htb default 20

tc class add dev $DEV0 parent 1: classid 1:1 htb rate 128kbit \
burst 6k

tc class add dev $DEV0 parent 1:1 classid 2: htb rate 128kbit \
burst 6k

All class attached to the same qdisc have the same major number. Numbering of classes and qdiscs : <major nuber>:<minor numer>.
2: is a valid name for a qdisc, but not for a class.

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 Homer Parker

On Tue, 3 Dec 2002 11:29:00 +0100 Stef Coene <[email protected]> wrote....

Quoted 7 lines
Quoted 7 lines

different things, all failing, some worse than others. The end result is to throttle back 126 IP's individually. I've read so much over the last few days, I've almost confused myself, and probably have ;) Thanks for any and all help!

tc qdisc add dev $DEV0 root handle 1: htb default 20

Quoted 8 lines
Quoted 5 lines

tc class add dev $DEV0 parent 1: classid 1:1 htb rate 128kbit \
burst 6k

tc class add dev $DEV0 parent 1:1 classid 2: htb rate 128kbit \
burst 6k

All class attached to the same qdisc have the same major number. Numbering of classes and qdiscs : <major nuber>:<minor numer>. 2: is a valid name for a qdisc, but not for a class.

Ok, I've tried grasping what you are telling me here, let's see how far
off I am now... From the example in 9.5.5.1:

# tc qdisc add dev eth0 root handle 1: htb default 30
# tc class add dev eth0 parent 1: classid 1:1 htb rate 6mbit burst 15k
# tc class add dev eth0 parent 1:1 classid 1:10 htb rate 5mbit burst 15k
# tc class add dev eth0 parent 1:1 classid 1:20 htb rate 3mbit ceil 6mbit
# burst 15k tc class add dev eth0 parent 1:1 classid 1:30 htb rate 1kbit
# ceil 6mbit burst 15k

The author then recommends SFQ for beneath these classes:

# tc qdisc add dev eth0 parent 1:10 handle 10: sfq perturb 10
# tc qdisc add dev eth0 parent 1:20 handle 20: sfq perturb 10
# tc qdisc add dev eth0 parent 1:30 handle 30: sfq perturb 10

Add the filters which direct traffic to the right classes:

# U32="tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32" # $U32 match ip dport 80 0xffff flowid 1:10
# $U32 match ip sport 25 0xffff flowid 1:20

If I started with something similar to this, then I would just start
building under the 10:, 20:, 30: for the different IP's? If that's the case, then I would send all of x.x.x.x to 10:1, and then have the different rates and priorities within th 10:1 block? Am I on the right track, or completely out in left field?

Quoted 1 line

#lartc @ irc.oftc.net

	I can never find anyone in there, lots of names, no responses :(

---
Homer Parker

http://www.homershut.net
telnet://bbs.homershut.net

#3 lore raw
In reply to Homer Parker
Quoted 44 lines · Homer Parker

On Tue, 3 Dec 2002 11:29:00 +0100 Stef Coene <[email protected]> wrote....

Quoted 10 lines
Quoted 10 lines

different things, all failing, some worse than others. The end result is to throttle back 126 IP's individually. I've read so much over the last few days, I've almost confused myself, and probably have ;) Thanks for any and all help!

tc qdisc add dev $DEV0 root handle 1: htb default 20

tc class add dev $DEV0 parent 1: classid 1:1 htb rate 128kbit \
burst 6k

Quoted 6 lines
Quoted 2 lines

tc class add dev $DEV0 parent 1:1 classid 2: htb rate 128kbit \
burst 6k

All class attached to the same qdisc have the same major number. Numbering of classes and qdiscs : <major nuber>:<minor numer>. 2: is a valid name for a qdisc, but not for a class.

Ok, I've tried grasping what you are telling me here, let's see how far
off I am now... From the example in 9.5.5.1:

# tc qdisc add dev eth0 root handle 1: htb default 30
# tc class add dev eth0 parent 1: classid 1:1 htb rate 6mbit burst 15k
# tc class add dev eth0 parent 1:1 classid 1:10 htb rate 5mbit burst 15k
# tc class add dev eth0 parent 1:1 classid 1:20 htb rate 3mbit ceil 6mbit
# burst 15k tc class add dev eth0 parent 1:1 classid 1:30 htb rate 1kbit
# ceil 6mbit burst 15k

The author then recommends SFQ for beneath these classes:

# tc qdisc add dev eth0 parent 1:10 handle 10: sfq perturb 10
# tc qdisc add dev eth0 parent 1:20 handle 20: sfq perturb 10
# tc qdisc add dev eth0 parent 1:30 handle 30: sfq perturb 10

Add the filters which direct traffic to the right classes:

# U32="tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32" # $U32 match ip dport 80 0xffff flowid 1:10
# $U32 match ip sport 25 0xffff flowid 1:20

Quoted 5 lines

If I started with something similar to this, then I would just start
building under the 10:, 20:, 30: for the different IP's? If that's the case, then I would send all of x.x.x.x to 10:1, and then have the different rates and priorities within th 10:1 block? Am I on the right track, or completely out in left field?

It all depends on what you want to do. Have you read my docs on www.docum.org ?? But you are on the right track.
I have some remarks. 1kbit rate is _very_ low. And 15k burst is not much for 5mbit rate. If you don't specify the burst or cburst paramter, tc will calculate the most optimal setting for you.

Quoted 2 lines
Quoted 1 line

#lartc @ irc.oftc.net

	I can never find anyone in there, lots of names, no responses :(

I'm there if I'm at home (nick name staf).

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/
#4 lore raw
In reply to Homer Parker

On Tue, 3 Dec 2002 22:03:39 +0100 Stef Coene <[email protected]> wrote....

Quoted 2 lines

It all depends on what you want to do. Have you read my docs on www.docum.org ?? But you are on the right track.

Ok, starting from scratch (again).. This loads and runs just fine:

tc qdisc del dev eth0 root
tc qdisc del dev eth1 root

tc qdisc add dev eth0 root handle 10: htb
tc class add dev eth0 parent 10: classid 10:1 htb rate 10mbit

# tc class add dev eth0 parent 10:1 classid 10:10 htb rate 256kbit
tc qdisc add dev eth0 parent 10:1 sfq perturb 10
tc filter add dev eth0 parent 10: protocol ip \
  u32 match ip dst 208.191.32.254 flowid 10:1
# exit

tc qdisc add dev eth1 root handle 20: htb
tc class add dev eth1 parent 20: classid 20:1 htb rate 10mbit

# tc class add dev eth1 parent 20:1 classid 20:10 htb rate 256kbit
tc qdisc add dev eth1 parent 20:1 sfq  perturb 10
tc filter add dev eth1 parent 20: protocol ip \
  u32 match ip src 208.191.32.254 flowid 20:1

Whereas this doesn't...

tc qdisc del dev eth0 root
tc qdisc del dev eth1 root

tc qdisc add dev eth0 root handle 10: htb
tc class add dev eth0 parent 10: classid 10:1 htb rate 10mbit tc class add dev eth0 parent 10:1 classid 10:10 htb rate 256kbit tc qdisc add dev eth0 parent 10:10 sfq perturb 10
tc filter add dev eth0 parent 10: protocol ip \
u32 match ip dst 208.191.32.254 flowid 10:10

# exit

tc qdisc add dev eth1 root handle 20: htb
tc class add dev eth1 parent 20: classid 20:1 htb rate 10mbit tc class add dev eth1 parent 20:1 classid 20:10 htb rate 256kbit tc qdisc add dev eth1 parent 20:10 sfq perturb 10
tc filter add dev eth1 parent 20: protocol ip \
u32 match ip src 208.191.32.254 flowid 20:10

When i say does and doesn't work, the first on passes data, the second
one doesn't, and the pings I was testing with showed up as dropped packets when I ran "tc -s class ls dev eth1", which I thought odd... Especially since they showed up in the root class... Welp, it's 4am (again), time to get a nap...

---
Homer Parker

http://www.homershut.net
telnet://bbs.homershut.net