linux traffic control tc token bucket parameters - Networking

This is a discussion on linux traffic control tc token bucket parameters - Networking ; 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 ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: linux traffic control tc token bucket parameters

  1. linux traffic control tc token bucket parameters

    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 mbit burst
    kb latency ms peakrate

    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


  2. Re: linux traffic control tc token bucket parameters

    On 28 avr, 11:14, 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 mbit burst
    > kb latency ms peakrate

    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


  3. Re: linux traffic control tc token bucket parameters

    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 mbit burst
    > kb latency ms peakrate

    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.