Limiting interface bandwidth with tc under Linux
Posted
by
Matt
on Server Fault
See other posts from Server Fault
or by Matt
Published on 2012-11-28T00:43:46Z
Indexed on
2012/11/28
5:07 UTC
Read the original article
Hit count: 514
I have a linux router which has a 10GBe interface on the outside and bonded Gigabit ethernet interfaces on the inside.
We have currently budget for 2GBit/s. If we exceed that rate by more than 5% average for a month then we'll be charged for the whole 10Gbit/s capacity. Quite a step up in dollar terms.
So, I want to limit this to 2GBit/s on 10GBe interface.
TBF filter might be ideal, but this comment is of concern.
On all platforms except for Alpha, it is able to shape up to 1mbit/s of normal traffic with ideal minimal burstiness, sending out data exactly at the configured rates.
Should I be using TBF or some other filter to apply this rate to the interface and how would I do it. I don't understand the example given here: Traffic Control HOWTO
In particular "Example 9. Creating a 256kbit/s TBF"
tc qdisc add dev eth0 handle 1:0 root dsmark indices 1 default_index 0
tc qdisc add dev eth0 handle 2:0 parent 1:0 tbf burst 20480 limit 20480 mtu 1514 rate 32000bps
How is the 256K bit/s rate calculated? In this example, 32000bps = 32k bytes per second. Since tc uses bps = bytes per second. I guess burst and limit come into play but how would you go about choosing sensible numbers to reach the desired rate?
This is not a mistake. I tested this and it gave a rate close to 256K but not exactly that.
© Server Fault or respective owner