Last Updated: February 25, 2016
· steve-jansen

How to simulate bad internet connectivity for testing

You've got unit tests, integration tests, and performance tests. Awesome sauce!

Have you tested how you app will behave over a crappy connection to the interwebs? Apps can start to act quite strange when faced with low bandwidth, high latency, or jitter.

The Comcast Slowskys


For OS X users, you are in luck with two options. Apple's Xcode developer tools includes a GUI app named Network Link Conditioner (NLC). On the command line, you've got ipfw out of the box to sloooow down your internet connection.


Matt Thompson @ NSHipster did a great write-up on Apple's Network Link Conditioner. Matt Gemmel also gives some examples.

OS X Terminal - ipfw

On the command line, ipfw is the man for the job. (I believe NLC is just a GUI around ipfw rules0.

Spiff gave some great examples of ipfw rules on SO:

limit the total incoming TCP traffic to 2Mbit/s, and UDP to 300Kbit/s

sudo ipfw add pipe 2 in proto tcp
sudo ipfw add pipe 3 in proto udp
sudo ipfw pipe 2 config bw 2Mbit/s
sudo ipfw pipe 3 config bw 300Kbit/s

limit incoming traffic to 300Kbit/s for each host on network

sudo ipfw add pipe 4 src-ip in
sudo ipfw pipe 4 config bw 300Kbit/s queue 20 mask dst-ip 0x000000ff

simulate an ADSL link to the moon:

sudo ipfw add pipe 3 out
sudo ipfw add pipe 4 in
sudo ipfw pipe 3 config bw 128Kbit/s queue 10 delay 1000ms
sudo ipfw pipe 4 config bw 640Kbit/s queue 30 delay 1000ms

And to reset to your initial settings:

sudo ipfw flush

ipfw is also available on FreeBSD distros


If you are a Windows user, check out Fiddler's support for bandwidth limiting via its WinSOCKS proxy.

3 Responses
Add your response

Very useful.

over 1 year ago ·

Super useful !

over 1 year ago ·

fiddler can be used for many things and one of them is the ability to delay responses through an extension.

over 1 year ago ·