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