Using tc to simulate low bandwidth, latency and jitter.

Sometimes you'ld like to get a better idea how your application will perform or user experience will alter when the network connection is slow or poor.

For example, you have a remote site and would like to know what CIFS file shares will perform like, or work out how many remote desktop sessions you can handle etc..

Linux comes with tc from the iproute package. This offers a huge array of options for traffic shaping.

4 line bandwidth limiting and latency adding

tc qdisc add dev eth1 handle 1: root htb default 11
tc class add dev eth1 parent 1: classid 1:1 htb rate $MAXBW
tc class add dev eth1 parent 1:1 classid 1:11 htb rate $MAXBW
tc qdisc add dev eth1 parent 1:11  netem delay $LATENCY $LATENCY_VARIATION $LATENCY_PERCENTAGE

Where $MAXBW is the maximum bandwidth in bytes, $LATENCY is the amount of lag you want to add, $LATENCY_VARIATION is the amount +/- you want to add, and $LATENCY_PERCENTAGE is the amount that each packet affects the others ( skew from a normal random distribution ).

There are many more options but thats enough to get something that looks very "real world"