user1950996
user1950996

Reputation:

Introduce delay between each packet

So I know I can delay all the packets of a stream for a given delay using Linux tc and netem. What is presented here http://www.linuxfoundation.org/collaborate/workgroups/networking/netem#Delay_distribution just delays all of the packets for a given amount of time, not changing the intervals between the actual packets.

What I want to do is set the minimal interval time between each consecutive pair of packets to be say 100ms. And I don't want any reordering.

Any thought much appreciated.

Regards,

kravvcu

Upvotes: 0

Views: 1853

Answers (1)

lorem
lorem

Reputation: 1199

So, if I understood your requirement right, You want a constant interpacket delay of 100ms and no reordering. The command in the link you mentioned(linux foundation) introduces a delay of 100ms and a jitter of 20ms. This jitter creates reordering.

There are 2 approaches to meet your requirement.

  • if jitter is not required:-tc qdisc add/change/replace dev eth0 root netem delay 100ms
  • if jitter is required:- The trick is to use a high rate parameter in your netem command. netem internally maintains a tfifo queue. with the rate parameter netem calculates the packet delay of the next packet based on the time-to-send of the last packet in its tfifo queue. Thus having delay and jitter but no reordering.

The command to the same is
tc qdisc add/change/replace dev eth0 root netem rate 1000mbit delay 100ms

rate 1000mbit or any rate which is very high does the job!

This feature is not documented anywhere. However, was discussed back in 2011/2012/2013 in the linux netdev mailing list. ATM I cannot find the link to the same. However, I can point to the linux source code which implements the above mentioned code.

http://lxr.free-electrons.com/source/net/sched/sch_netem.c#L495

Please vote if the answer was useful!

Upvotes: 2

Related Questions