Skip to contentSkip to conversation

limiting users on a 128kbit line

LARTC radus 2 participants 3 messages Feb 19, 2003 – Feb 20, 2003

lore
Share & tools
lore

radus

author
#0 lore raw

Hello!

I've been trying to write a traffic shaper for a 128kbit line with this setup :
5 computers that get dedicated bandwidth and the rest go in a pool with bigger priorities.

I made the attached script, but it seems it doesn't work...

It sends the traffic coming from the dedicated ips to the default class. Where is the error ?

Will this setup work if the bandwidth is full ?
Since it's not a guaranteed bandwidth can i put no ceiling but still all the ips to have their equal share ?

I've set r2q to 1 (it's the smallest one possible, no ? ) and it receive warnings that the quantum is too small

Thanks in advance....

Radu

Here's the script :

tc qdisc add dev eth1 root handle 1: htb default 14 r2q 1 tc class add dev eth1 parent 1: classid 1:1 htb rate 128kbit burst 2k tc class add dev eth1 parent 1:1 classid 1:10 htb rate 48kbit burst 2k

tc class add dev eth1 parent 1:1 classid 1:20 htb rate 12kbit ceil 128kbit burst 2k

tc class add dev eth1 parent 1:1 classid 1:30 htb rate 12kbit ceil 128kbit burst 2k

tc class add dev eth1 parent 1:1 classid 1:40 htb rate 12kbit ceil 128kbit burst 2k

tc class add dev eth1 parent 1:1 classid 1:50 htb rate 12kbit ceil 128kbit burst 2k

tc class add dev eth1 parent 1:1 classid 1:11 htb rate 20kbit ceil 128kbit burst 2k

tc class add dev eth1 parent 1:11 classid 1:12 htb rate 10kbit  burst 2k
tc class add dev eth1 parent 1:11 classid 1:13 htb rate 5kbit   burst 2k
tc class add dev eth1 parent 1:11 classid 1:14 htb rate 5kbit   burst 2k
tc qdisc add dev eth1 parent 1:20 handle 20:  sfq perturb 15
tc qdisc add dev eth1 parent 1:30 handle 30:  sfq perturb 15
tc qdisc add dev eth1 parent 1:40 handle 40:  sfq perturb 15
tc qdisc add dev eth1 parent 1:50 handle 50:  sfq perturb 15
tc qdisc add dev eth1 parent 1:12 handle 12:  sfq perturb 15
tc qdisc add dev eth1 parent 1:13 handle 13:  sfq perturb 15
tc qdisc add dev eth1 parent 1:14 handle 14:  sfq perturb 15

tc filter add dev eth1 protocol ip parent 1: u32 match ip dst 192.168.0.45 flowid 1:20

tc filter add dev eth1 protocol ip parent 1: u32 match ip dst 192.168.0.4 flowid 1:30

tc filter add dev eth1 protocol ip parent 1: u32 match ip dst 192.168.0.50 flowid 1:40

tc filter add dev eth1 protocol ip parent 1: u32 match ip dst 192.168.0.38 flowid 1:50

tc filter add dev eth1 protocol ip parent 1: prio 1 u32 match ip sport 80 0xffff flowid 1:12
tc filter add dev eth1 protocol ip parent 1: prio 2 u32 match ip sport 25 0xffff flowid 1:13
tc filter add dev eth1 protocol ip parent 1: prio 3 u32 match ip sport 110 0xffff flowid 1:13

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

author
#1 lore raw

Hello!
First, thanks for the reply...

Quoted 7 lines
Quoted 2 lines

5 computers that get dedicated bandwidth and the rest go in a pool with bigger priorities.

I do not see the priorities in your script. Only some of the filters have priorities, but it has nothing to do with scheduling (you should give prioirties to the HTB classes).

I made priorities only for the big class where the default traffic goes, so that the remaining 5 computers share the bandwidth equally (when it's free) I should write prios for all classes ?

Quoted 1 line

You mean it all goes to 1:14 ?

Yes, exactly that....

Quoted 11 lines

Quantum = rate/r2q
For class 1:12, quantum = 10k/r2q = 10*1024(8*r2q) = 1280Bytes. This is smaller than MTU, that's why it complains that quantum is too small.

Same thing for classes 1:13 and 1:14, quantum = 640 Bytes, which is smaller them MTU.

What you can (and should) do is specify the quantum manually.

Could you give me an example for a class on how to specify the quantum ?

Radu

Quoted 46 lines
Quoted 46 lines

Here's the script :

tc qdisc add dev eth1 root handle 1: htb default 14 r2q 1 tc class add dev eth1 parent 1: classid 1:1 htb rate 128kbit burst 2k tc class add dev eth1 parent 1:1 classid 1:10 htb rate 48kbit burst 2k

tc class add dev eth1 parent 1:1 classid 1:20 htb rate 12kbit ceil 128kbit burst 2k

tc class add dev eth1 parent 1:1 classid 1:30 htb rate 12kbit ceil 128kbit burst 2k

tc class add dev eth1 parent 1:1 classid 1:40 htb rate 12kbit ceil 128kbit burst 2k

tc class add dev eth1 parent 1:1 classid 1:50 htb rate 12kbit ceil 128kbit burst 2k

tc class add dev eth1 parent 1:1 classid 1:11 htb rate 20kbit ceil 128kbit burst 2k

tc class add dev eth1 parent 1:11 classid 1:12 htb rate 10kbit  burst 2k
tc class add dev eth1 parent 1:11 classid 1:13 htb rate 5kbit   burst 2k
tc class add dev eth1 parent 1:11 classid 1:14 htb rate 5kbit   burst 2k
tc qdisc add dev eth1 parent 1:20 handle 20:  sfq perturb 15
tc qdisc add dev eth1 parent 1:30 handle 30:  sfq perturb 15
tc qdisc add dev eth1 parent 1:40 handle 40:  sfq perturb 15
tc qdisc add dev eth1 parent 1:50 handle 50:  sfq perturb 15
tc qdisc add dev eth1 parent 1:12 handle 12:  sfq perturb 15
tc qdisc add dev eth1 parent 1:13 handle 13:  sfq perturb 15
tc qdisc add dev eth1 parent 1:14 handle 14:  sfq perturb 15

tc filter add dev eth1 protocol ip parent 1: u32 match ip dst 192.168.0.45 flowid 1:20

tc filter add dev eth1 protocol ip parent 1: u32 match ip dst 192.168.0.4 flowid 1:30

tc filter add dev eth1 protocol ip parent 1: u32 match ip dst 192.168.0.50 flowid 1:40

tc filter add dev eth1 protocol ip parent 1: u32 match ip dst 192.168.0.38 flowid 1:50

Quoted 7 lines
Quoted 6 lines

tc filter add dev eth1 protocol ip parent 1: prio 1 u32 match ip sport 80 0xffff flowid 1:12
tc filter add dev eth1 protocol ip parent 1: prio 2 u32 match ip sport 25 0xffff flowid 1:13
tc filter add dev eth1 protocol ip parent 1: prio 3 u32 match ip sport 110 0xffff flowid 1:13

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

#2 lore raw
In reply to radus

Radus, see below.
Mathieu.

Quoted 5 lines · radus

I made priorities only for the big class where the default traffic goes, so that the remaining 5 computers share the bandwidth equally (when it's free) I should write prios for all classes ?

Priorities to the filter means which filter is tried first. Prio to HTB classes will influence the sheduling and borrowing of HTB.

Quoted 4 lines
Quoted 2 lines

You mean it all goes to 1:14 ?

Yes, exactly that....

Default should be 11, not 14. Your three filters filtering on sport should have as parent 1: (as right now)
and they should all have flowid 1:11. Then, you create three similar filters with parent 1:11 and flowid 1:12, 1:13 and 1:14 respectively.

Something like:

tc filter add dev eth1 protocol ip parent 1: prio 1 u32 match ip sport 80 0xffff flowid 1:11
tc filter add dev eth1 protocol ip parent 1: prio 2 u32 match ip sport 25 0xffff flowid 1:11
tc filter add dev eth1 protocol ip parent 1: prio 3 u32 match ip sport 110 0xffff flowid 1:11

tc filter add dev eth1 protocol ip parent 1:11 u32 match ip sport 80 0xffff flowid 1:12
tc filter add dev eth1 protocol ip parent 1:11 u32 match ip sport 25 0xffff flowid 1:13
tc filter add dev eth1 protocol ip parent 1:11 u32 match ip sport 110 0xffff flowid 1:13

Quoted 7 lines
Quoted 7 lines

Quantum = rate/r2q
For class 1:12, quantum = 10k/r2q = 10*1024(8*r2q) = 1280Bytes. This is smaller than MTU, that's why it complains that quantum is too small.

Quoted 7 lines
Quoted 5 lines

Same thing for classes 1:13 and 1:14, quantum = 640 Bytes, which is smaller them MTU.

What you can (and should) do is specify the quantum manually.

Could you give me an example for a class on how to specify the quantum ?

For example:
tc class add dev eth1 parent 1:11 classid 1:14 htb rate 5kbit burst 2k quantum
1600

Note that quantum will influence the borrowing of HTB. See the HTB home page for details.

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