table of contents
other versions
- wheezy 20120521-3+b3
- wheezy-backports 3.16.0-2~bpo70+1
- jessie 3.16.0-2
- testing 4.9.0-1
- unstable 4.9.0-1
TC(8) | Linux | TC(8) |
NAME¶
tbf - Token Bucket FilterSYNOPSIS¶
tc qdisc ... tbf rate rate burst bytes/cell ( latency ms | limit bytes ) [ mpu bytes [ peakrate rate mtu bytes/cell ] ] burst is also known as buffer and maxburst. mtu is also known as minburst.DESCRIPTION¶
The Token Bucket Filter is a classful queueing discipline available for traffic control with the tc(8) command.ALGORITHM¶
As the name implies, traffic is filtered based on the expenditure of tokens. Tokens roughly correspond to bytes, with the additional constraint that each packet consumes some tokens, no matter how small it is. This reflects the fact that even a zero-sized packet occupies the link for some time.PARAMETERS¶
See tc(8) for how to specify the units of these values.- limit or latency
- Limit is the number of bytes that can be queued waiting for tokens to become available. You can also specify this the other way around by setting the latency parameter, which specifies the maximum amount of time a packet can sit in the TBF. The latter calculation takes into account the size of the bucket, the rate and possibly the peakrate (if set). These two parameters are mutually exclusive.
- burst
- Also known as buffer or maxburst. Size of the bucket, in
bytes. This is the maximum amount of bytes that tokens can be available
for instantaneously. In general, larger shaping rates require a larger
buffer. For 10mbit/s on Intel, you need at least 10kbyte buffer if you
want to reach your configured rate!
- mpu
- A zero-sized packet does not use zero bandwidth. For ethernet, no packet uses less than 64 bytes. The Minimum Packet Unit determines the minimal token usage (specified in bytes) for a packet. Defaults to zero.
- rate
- The speed knob. See remarks above about limits! See tc(8) for units.
- peakrate
- Maximum depletion rate of the bucket. The peakrate does not
need to be set, it is only necessary if perfect millisecond timescale
shaping is required.
- mtu/minburst
- Specifies the size of the peakrate bucket. For perfect
accuracy, should be set to the MTU of the interface. If a peakrate is
needed, but some burstiness is acceptable, this size can be raised. A 3000
byte minburst allows around 3mbit/s of peakrate, given 1000 byte packets.
EXAMPLE & USAGE¶
To attach a TBF with a sustained maximum rate of 0.5mbit/s, a peakrate of 1.0mbit/s, a 5kilobyte buffer, with a pre-bucket queue size limit calculated so the TBF causes at most 70ms of latency, with perfect peakrate behaviour, issue: # tc qdisc add dev eth0 handle 10: root tbf rate 0.5mbit \burst 5kb latency 70ms peakrate 1mbit \
minburst 1540 To attach an inner qdisc, for example sfq, issue: # tc qdisc add dev eth0 parent 10:1 handle 100: sfq Without inner qdisc TBF queue acts as bfifo. If the inner qdisc is changed the limit/latency is not effective anymore.
SEE ALSO¶
tc(8)AUTHOR¶
Alexey N. Kuznetsov, <kuznet@ms2.inr.ac.ru>. This manpage maintained by bert hubert <ahu@ds9a.nl>13 December 2001 | iproute2 |