Networking Forums

Networking Forums > Computer Networking > Linux Networking > linux traffic control tc token bucket parameters

Reply
Thread Tools Display Modes

linux traffic control tc token bucket parameters

 
 
Darth
Guest
Posts: n/a

 
      04-28-2007, 09:14 AM
Hi,

I am trying to create a token bucket filter(b,r,p) with latency L. So
after some work I figured out the following configuration lines to be
added using tc on a comp which is simply forwarding packets from one
interface (eth0) to another interface (eth1) :

tc qdisc add dev eth1 root handle 1:0 prio

tc filter add dev eth1 parent 1:0 prio 1 protocol ip u32 match ip src
10.192.1.0/24 flowid 1:1

tc qdisc add dev eth1 parent 1:1 handle 10:0 tbf rate <r>mbit burst
<b>kb latency <L>ms peakrate <p>kbit minburst 1540

p is assumed to be always 1

How are r,b,L realted so that the 3rd statement becomes valid ?

For e.g. when I assigned values (r,b,L) = (0.5,5,70) the statement was
accepted BUT when I assigned values (r,b,L) = (1,10,70) I got the
error: RTNETLINK answers: Invalid argument

I want to limit the sending rate of the packets from 10.192.1.0/24
onto eth1 to 100kbps, 1 Mbps and 5 Mbps with latency taking values 10
ms, 50 ms and 100 ms.

TIA,
Darth

 
Reply With Quote
 
 
 
 
Mouquiette
Guest
Posts: n/a

 
      05-02-2007, 12:33 PM
On 28 avr, 11:14, Darth <lodhaakhi...@gmail.com> wrote:
> Hi,
>
> I am trying to create a token bucket filter(b,r,p) with latency L. So
> after some work I figured out the following configuration lines to be
> added using tc on a comp which is simply forwarding packets from one
> interface (eth0) to another interface (eth1) :
>
> tc qdisc add dev eth1 root handle 1:0 prio
>
> tc filter add dev eth1 parent 1:0 prio 1 protocol ip u32 match ip src
> 10.192.1.0/24 flowid 1:1
>
> tc qdisc add dev eth1 parent 1:1 handle 10:0 tbf rate <r>mbit burst
> <b>kb latency <L>ms peakrate <p>kbit minburst 1540
>
> p is assumed to be always 1
>
> How are r,b,L realted so that the 3rd statement becomes valid ?
>
> For e.g. when I assigned values (r,b,L) = (0.5,5,70) the statement was
> accepted BUT when I assigned values (r,b,L) = (1,10,70) I got the
> error: RTNETLINK answers: Invalid argument
>
> I want to limit the sending rate of the packets from 10.192.1.0/24
> onto eth1 to 100kbps, 1 Mbps and 5 Mbps with latency taking values 10
> ms, 50 ms and 100 ms.
>
> TIA,
> Darth




For latency you may use netem, it works fine for me.
Ex:
tc qdisc add dev eth0 root handle 1: prio
tc qdisc add dev eth0 parent 1:3 handle 30: netem \
delay 200ms 10ms distribution normal
tc qdisc add dev eth0 parent 30:1 tbf rate 20kbit buffer 1600 limit
3000
tc filter add dev eth0 protocol ip parent 1:0 prio 3 u32 \
match ip dst 65.172.181.4/32 flowid 10:3

More informations about netem : http://linux-net.osdl.org/index.php/Netem

 
Reply With Quote
 
Andy Furniss
Guest
Posts: n/a

 
      05-05-2007, 11:48 PM
Darth wrote:
> Hi,
>
> I am trying to create a token bucket filter(b,r,p) with latency L. So
> after some work I figured out the following configuration lines to be
> added using tc on a comp which is simply forwarding packets from one
> interface (eth0) to another interface (eth1) :
>
> tc qdisc add dev eth1 root handle 1:0 prio
>
> tc filter add dev eth1 parent 1:0 prio 1 protocol ip u32 match ip src
> 10.192.1.0/24 flowid 1:1
>
> tc qdisc add dev eth1 parent 1:1 handle 10:0 tbf rate <r>mbit burst
> <b>kb latency <L>ms peakrate <p>kbit minburst 1540
>
> p is assumed to be always 1
>
> How are r,b,L realted so that the 3rd statement becomes valid ?
>
> For e.g. when I assigned values (r,b,L) = (0.5,5,70) the statement was
> accepted BUT when I assigned values (r,b,L) = (1,10,70) I got the
> error: RTNETLINK answers: Invalid argument
>
> I want to limit the sending rate of the packets from 10.192.1.0/24
> onto eth1 to 100kbps, 1 Mbps and 5 Mbps with latency taking values 10
> ms, 50 ms and 100 ms.


tbf latency param is just another way of specifying buffer length
(limit) 10ms@100kbit is smaller than a bulk packet, so doesn't really
make sense.

As for the error - I get it first time on your test, tc can be a bit
funny sometimes. If you are testing and get errors it's best to delete
the root and start again.

I don't use tbf so can't give a good example, try without miniburst
peakrate etc.

Andy.

Andy.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Traffic Control (tc) how to ? Darth Linux Networking 0 04-27-2007 10:01 PM
traffic control in linux Shashank Khanvilkar Linux Networking 1 06-16-2005 11:39 PM
Linux Traffic Control rahulhsaxena Linux Networking 0 06-04-2005 03:57 PM
linux traffic control and accounting mnis Linux Networking 7 04-15-2005 07:40 AM
Delaying packets using Token Bucket Filter Vanita Varma Linux Networking 1 09-28-2003 11:11 AM



1 2 3 4 5 6 7 8 9 10 11