• 5
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

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!

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.

  • 17
Reply Report
    • 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 ...
    • If you are using iptables version 1.3.5, the above command might error with message "iptables v1.3.5: Couldn't load match `random'". Below command worked for me - iptables -A FORWARD -m statistic --mode random --probability 0.2 -j DROP

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.

  • 3
Reply Report

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

  • 2
Reply Report
      • 2
    • 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.

Trending Tags