Skip to contentSkip to conversation

tc does'nt limit the bandwidth!

LARTC segun adesina 4 participants 5 messages Apr 13, 2004 – Apr 14, 2004

lore
Share & tools
lore
#0 lore raw

Hi, good people!

I wanted to limit my 4 customers to 144, 16, 32, and 32kbps.
I used the following tc commands BUT IT FAILED TO LIMIT each and everyone of them to its bandwidth.
What am I doing wrong:

My tc scripts are:

tc qdisc add dev eth1 root handle 1: htb default 1
#Classes#
tc class add dev eth1 parent 1: classid 1:1 htb
rate 9bps ceil 9bps #Default
tc class add dev eth1 parent 1: classid 1:100 htb
rate 9bps ceil 9bps #ICMP

tc class add dev eth1 parent 1: classid 1:5 htb
rate 144kbps ceil 256kbps #customer A
tc class add dev eth1 parent 1: classid 1:101 htb
rate 16kbps ceil 16kbps #customer B
tc class add dev eth1 parent 1: classid 1:111 htb
rate 32kbps ceil 32kbps #customer C
tc class add dev eth1 parent 1: classid 1:121 htb
rate 32kbps ceil 32kbps #customer D

Can anyone help me on how to limit the the bandwidth to these customers.
Regards.

Digihall7.

__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw
Quoted 8 lines · segun adesina

Hi, good people!

I wanted to limit my 4 customers to 144, 16, 32, and 32kbps.
I used the following tc commands BUT IT FAILED TO LIMIT each and everyone of them to its bandwidth.
What am I doing wrong:

Quoted 6 lines

My tc scripts are:

tc qdisc add dev eth1 root handle 1: htb default 1
#Classes#
tc class add dev eth1 parent 1: classid 1:1 htb
rate 9bps ceil 9bps #Default

          ^^^^

9bps? Shouldn't that be at least 256kbps?

<snip>

Quoted 6 lines

Can anyone help me on how to limit the the bandwidth to these customers.
Regards.

Digihall7.

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

#2 lore raw
In reply to segun adesina
Quoted 7 lines · segun adesina

Hi, good people!

I wanted to limit my 4 customers to 144, 16, 32, and 32kbps.
I used the following tc commands BUT IT FAILED TO LIMIT each and everyone of them to its bandwidth.
What am I doing wrong:

Do you know that tc uses somewhat unconventional abbreviations? kbps means kiloBYTEs per second and kbit means kiloBITs per second. That would really screw up the limiting if you had that mixed up. Read the "Units" secion of the man page.

Quoted 11 lines

My tc scripts are:

tc qdisc add dev eth1 root handle 1: htb default 1
#Classes#
tc class add dev eth1 parent 1: classid 1:1 htb
rate 9bps ceil 9bps #Default
tc class add dev eth1 parent 1: classid 1:100 htb
rate 9bps ceil 9bps #ICMP

Quoted 2 lines

tc class add dev eth1 parent 1: classid 1:5 htb
rate 144kbps ceil 256kbps #customer A

This class has a higher ceiling than its rate, which means it is allowed to "borrow" unused bandwidth from the other classes. I don't know if you intended that.

Quoted 7 lines

tc class add dev eth1 parent 1: classid 1:101 htb
rate 16kbps ceil 16kbps #customer B
tc class add dev eth1 parent 1: classid 1:111 htb
rate 32kbps ceil 32kbps #customer C
tc class add dev eth1 parent 1: classid 1:121 htb
rate 32kbps ceil 32kbps #customer D

All these classes are operating on eth1, and should restrict bandwidth leaving that interface. If you want to restrict traffic moving in the other direction, you may need a corresponding set of classes.

You haven't shown us any of your tc filter commands. If nothing I've said above has helped any, then you probably have to give us more information or we won't be able to find what's wrong.

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

#3 lore raw
In reply to segun adesina

first you cant use limit of 9 bits /s it is 1 byte /s, so completely unreasonable speed. set it to 50 bytes/s at least

another popstential problem that you are using independent root classes for each client
that means they wont share bandwitch. customer a will always get 256 kbits and others will get their ceil limit all time.

and my suggestion is to NOT touch default or you may have problems if rate = ceil then just specify rate.

if you want your clients share bandwitch then you need to create one root class and attach everyone to it.
this will look like this:

tc qdisc add dev eth1 root handle 1: htb default 1
#Classes#

tc class add dev eth1 parent 1: classid 1:5 htb
rate 230kbps #root (set rate to 80-90% of link capacity)

tc class add dev eth1 parent 1:5 classid 1:100 htb
rate 9bps ceil 9bps #ICMP

tc class add dev eth1 parent 1:5 classid 1:100 htb
rate 144kbps ceil 230kbps #customer A
tc class add dev eth1 parent 1:5 classid 1:101 htb
rate 16kbps #customer B
tc class add dev eth1 parent 1:5 classid 1:111 htb
rate 32kbps #customer C
tc class add dev eth1 parent 1:5 classid 1:121 htb
rate 32kbps #customer D

b,c and d will get always and only rate amount of trafic

----- Original Message -----
From: "segun adesina" <[email protected]>
To: <[email protected]>
Sent: Tuesday, April 13, 2004 11:13 PM
Subject: [LARTC] tc does'nt limit the bandwidth!

Quoted 38 lines

Hi, good people!

I wanted to limit my 4 customers to 144, 16, 32, and 32kbps.
I used the following tc commands BUT IT FAILED TO LIMIT each and everyone of them to its bandwidth.
What am I doing wrong:

My tc scripts are:

tc qdisc add dev eth1 root handle 1: htb default 1
#Classes#
tc class add dev eth1 parent 1: classid 1:1 htb
rate 9bps ceil 9bps #Default
tc class add dev eth1 parent 1: classid 1:100 htb
rate 9bps ceil 9bps #ICMP

tc class add dev eth1 parent 1: classid 1:5 htb
rate 144kbps ceil 256kbps #customer A
tc class add dev eth1 parent 1: classid 1:101 htb
rate 16kbps ceil 16kbps #customer B
tc class add dev eth1 parent 1: classid 1:111 htb
rate 32kbps ceil 32kbps #customer C
tc class add dev eth1 parent 1: classid 1:121 htb
rate 32kbps ceil 32kbps #customer D

Can anyone help me on how to limit the the bandwidth to these customers.
Regards.

Digihall7.

Quoted 8 lines

__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

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

#4 lore raw
In reply to segun adesina

Good people,
I want to thank you all for your awesome help so far and also want to make my problem clear to you all so that I can get more definite help.

I have 256kpbs internet link to share among 4 customers- A6 burstable to 256; B; C2; D2.

But the problem is that my script FAILED TO LIMIT customers B, C,and D.

My complete tc scripts is as follows;

tc qdisc add dev eth1 root handle 1: htb default 1
#Classes
tc class add dev eth1 parent 1: classid 1:1 htb
rate 9bps ceil 9bps #Default
tc class add dev eth1 parent 1: classid 1:100 htb
rate 9bps ceil 9bps #ICMP
tc class add dev eth1 parent 1: classid 1:5 htb
rate 176kbps ceil 256kbps #Customer A
tc class add dev eth1 parent 1: classid 1:101 htb
rate 16kbps ceil 16kbps #Customer B
tc class add dev eth1 parent 1: classid 1:111 htb
rate 32kbps ceil 32kbps #Customer C
tc class add dev eth1 parent 1: classid 1:121 htb
rate 32kbps ceil 32kbps #Customer D
#Leafs
# A #
tc class add dev eth1 parent 1:5 classid 1:90 htb
rate 176kbps ceil 256kbps
#Queues
tc qdisc add dev eth1 parent 1:11 handle 211: sfq
perturb 10 #Customer A
tc qdisc add dev eth1 parent 1:101 handle 281: sfq
perturb 10 # Customer B
tc qdisc add dev eth1 parent 1:111 handle 282: sfq
perturb 10 # Customer C
tc qdisc add dev eth1 parent 1:121 handle 283: sfq
perturb 10 # Customer D
#Ip Assignment#
U32="tc filter add dev eth1 protocol ip parent 1:0 prio 4 u32"
u32="tc filter add dev eth1 protocol ip parent 1:0 prio 0 u32"

                          # A #

$U32 match ip dst 200.200.200.11 flowid 1:11

$U32 match ip src 200.200.200.11 flowid 1:11
#Customer B#
$U32 match ip dst 172.16.0.11 flowid 1:101

$U32 match ip src 172.16.0.11 flowid 1:101
#Customer C#
$U32 match ip dst 172.16.0.12 flowid 1:111

$U32 match ip src 172.16.0.12 flowid 1:111
#Customer D#
$U32 match ip dst 172.16.0.13 flowid 1:121

$U32 match ip src 172.16.0.13 flowid 1:121 #virus ping
$U32 match ip protocol 1 0xff flowid 1:100

What exactly am I doing wrong please?

Can anyone re-write it for me or give me a better one please.

Kind regards.

Cheers!
digihall7

__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/