Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm building a network application and need to test its behavior under various bandwidths.

This question is an offshoot of this question. I was successfully able to test my application for different sets of bandwidth rates.

In addition I now want to test the application in which the bandwidth rate changes while the application is executing.

I figure that the same can be done manually/using a bash script (programmatically adding or deleting qdiscs), etc.

But it would be really useful if a tc command existed where I could simply provide a range of bandwidth values and the application switched to a random rate for the next packet transfer.

PS: I am very new to tc and therefore relatively verbose explanations / links to the same would be very helpful. Thanks!

share|improve this question
up vote 0 down vote accepted

The netem has most of the features required to simulate a physical network.

Specifically in this question,

# tc qdisc add dev eth0 root netem delay 100ms 10ms 25%

causes the packets sent through interface eth0 to experience a delay of 100ms ± 10ms. Therefore the pings would produce a round trip time (rtt) ranging from 180ms to 220 ms. (2*delay)

The delay in different instances isn't completely random though. We may, if we so wish chose to have a correlation between consecutive values.

The value 25% denotes that the next delay value has a 25% dependency on the previous delay value.

This isn't true statistical correlation, but an approximation.

We may also chose to have our random delays to follow a particular distribution

 # tc qdisc change dev eth0 root netem delay 100ms 20ms distribution normal

Note: These examples has been borrowed from the netem tutorial which possesses many other useful examples as well.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.