Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I was wondering if anyone had any experience setting up an environment designed purposefully for poor performance when sending/receiving requests over a network. I'm developing an application and would like to make it robust over extremely poor-performing networks. Does anyone know if it is possible to configure a router to:

  1. intermittently drop packets
  2. intermittently introduce latency in packets
  3. corrupt data in packets (this one isn't required as it would require opening the packet, changing the data, and updating the checksum since the TCP layer would catch this type of issue)

If not possible on a router, would it be possible to configure a computer to act as a router and do this?

Many thanks!

share|improve this question
add comment

3 Answers

up vote 15 down vote accepted

If you use a Linux box as a router, netfilter has a number of ways of messing with your packet traffic.

The random module can be used to randomly drop packets. For example, this:

iptables -A FORWARD -m random --average 10 -j DROP

will cause the router to randomly drop packets at an average rate of 10%.

You can also corrupt random packets with the XOR target, e.g.

iptables -A FORWARD -m random --average 1 -j XOR --key "junktoxortomypacket"

will corrupt 1% of forwarded packets by XORing them with a key derived from the given string.

share|improve this answer
    
This sounds awesome! Thanks Steven! Have you ever set this up? What Linux distro? –  Mark Nov 15 '10 at 4:13
    
I have had success creating routers for small networks using Debian. But really just about any Linux distro with a recent kernel should do just fine, since netfilter is built into the kernel. I have never actually tried creating a "bad" router as described here, but it might be an interesting project for a lazy Sunday afternoon ... –  Steven Monday Nov 15 '10 at 4:23
add comment

I've successfully used WANem to simulate network conditions of a WAN between Germany and India. WANem ships as a bootable CD or virtual appliance. You just boot it up, configure the desired network properites and then route your traffic through it. Quoting the official description:

WANem is a Wide Area Network Emulator, meant to provide a real experience of a Wide Area Network/Internet, during application development / testing over a LAN environment. Typically application developers develop applications on a LAN while the intended purpose for the same could be, clients accessing the same over the WAN or even the Internet. WANem thus allows the application development team to setup a transparent application gateway which can be used to simulate WAN characteristics like Network delay, Packet loss, Packet corruption, Disconnections, Packet re-ordering, Jitter, etc. WANem can be used to simulate Wide Area Network conditions for Data/Voice traffic and is released under the widely acceptable GPL v2 license.

share|improve this answer
add comment

Set the uplink port to 10Mbps and half duplex if you can. Then use a host on the network to ping the snot out of it. That ought to neuter you decently :D

share|improve this answer
    
Set the packet sizes on the pings to considerably larger than the default, too. This can be a really effective and easy way to simulate saturated/generally bad network links - if you can cripple the specific connection as noted by purposefully setting it's bandwidth to lower than what the 'attacking' machine has. –  Andrew Barber Nov 13 '10 at 23:19
    
You could also mess with MTU as well, pick a real oddball size :) –  SpacemanSpiff Nov 14 '10 at 2:02
add comment

Your Answer

 
discard

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.