How do I fake dropped packets (or actually make them fail)?

Background

One of our clients suffers from an intermittant problem with their internet where it will drop packets when a user downloads a large file (their IT is looking into the problem).

I have an application consisting of a Web Server running Windows 2008 R2 IIS7.5, and a client running Windows 7, Chrome which uses a long running XMlHttpRequest to transfer "messages" from the server to the client.

The problem.

My application should be should be fairly immune to these packet losses, but in practice it isn't.

I want to test the application under various different network problem scenarios, eg random 1 % packet loss, and bursty packet loss - say complete loss of packets for 4000 ms, and so on.

I'm looking for a solution which lets me "reproduce" a scenario and test my application. I could use 3G, or unplug and unplug the network cable, but the effects are not very reproduceable.

The question.

Is there an application/driver which I can install on my machine to mimick "dodgy" internet connections? Or perhaps an appliance or proxy server I can use in the network to mock these scenarios?

I'm guessing it's not very easy to do on a modern computer because I expect most of the TCP stack is offloaded to the network card, but I would have thought this was a reasonably popular thing to try and do, however I haven't had any luck on google. I'm more proficient on Windows, but a solution which uses Linux, either as a client, or proxy would be welcome.


A simple linux router in the middle could do this for you flawlessly. Just do some reading on netem. You can replicate everything including lost-packets, re-ordered packets, corrupted packets, and even latency. I use it myself for simulating satellite based links.


I've used TMNetSim to perform this. It proxies whatever port you want, so it could be used for most applications.

http://www.tmurgent.com/Tools.aspx

You may want to perform a correlated packet capture on both the client and server side, and determine if the client is receivign a RST packet. If so, is it coming from your server. And does it occur at predictable times, such as after five minutes of inactivity.