Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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'd like to simulate a high-latency, low-bandwidth network connection on my Linux machine.

Limiting bandwidth has been discussed before, e.g. here, but I can't find any posts which address limiting both bandwidth and latency.

I can get either high latency or low bandwidth using tc. But I haven't been able to combine these into a single connection. In particular, the example rate control script here doesn't work for me:

# tc qdisc add dev lo root handle 1:0 netem delay 100ms 
# tc qdisc add dev lo parent 1:1 handle 10: tbf rate 256kbit buffer 1600 limit 3000
RTNETLINK answers: Operation not supported

How can I create a low-bandwidth, high-latency connection, using tc or any other readily-available tool?

share|improve this question
have you tried combining approaches from your links, eg. use tc for latency and trickle for bandwidth? (It's uglier than just using tc, but might still work;) – Andy May 31 '10 at 5:35
That's a good idea (and, indeed, trickle will even add latency), but unfortunately Firefox doesn't load under trickle, and that's what I need to test. – Justin L. May 31 '10 at 19:01
up vote 12 down vote accepted

Aha! It works if we reverse the order of the commands.

tc qdisc add dev lo root handle 1: htb default 12 
tc class add dev lo parent 1:1 classid 1:12 htb rate 20kbps ceil 20kbps 
tc qdisc add dev lo parent 1:12 netem delay 1000ms

share|improve this answer
Anyone interested as to why, it seems that the netem qdisc cannot be a parent, so you have to rearrange the hierarchy to have it as a leaf node. – Andy Jun 2 '10 at 6:32
Note that the bandwidth limit is in one direction only (outgoing). You have to do additional work to make it happen in both directions (apparently using ifb).… – Roger Binns Nov 30 '12 at 6:37
Came across this when trying to grok tc. From what I've read the first line creates 1:0, but the second line refers to 1:1? (probably my understanding which is wrong - but I've peered at lots of pages trying to understand how classes/qtdiscs are numbered) – symcbean Apr 8 '13 at 22:03

It's not free, but the Charles Web Debugging Proxy can simulate low bandwidth high latency connections

share|improve this answer
Interestingly enough, I'm actually doing this for web debugging. But surely there must be a way to do this without spending money. :) – Justin L. May 31 '10 at 5:26
Sadly Charles doesn't seem to work with local traffic. It dies when I try to access through the proxy. – Justin L. May 31 '10 at 7:15
Or just use WANEm, for free: – Nathan Kidd Jan 27 '11 at 17:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .