views:

38

answers:

3

I would like to simulate packets reordering for UDP packets on Linux to measure the performance and fault tolerance of my application. Is there a simple way to do this?

+2  A: 

look into WANEM

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.

fseto
+1  A: 

You could try scapy. It's a python library to manipulate packets. You could capture a pcap session, with tcpdump, wireshark, whatever, and then replay the captured packets in arbitrary order with scapy.

a=rdpcap("/spare/captures/isakmp.cap")
for pkt in a.reverse():
   sendp(pkt)

Depending on how you catpured the packets you may need send(layer 3) rather than sendp(layer 2)

Paul Rubel
+1  A: 

You can use the "netem" feature built-into the Linux kernel. It is shipped with most modern distributions. netem is a traffic control discipline module which deliberately delays, drops and reorders packets and is highly configurable.

This only works for sending packets (because the queues are outbound only), so you may wish to place a router host with netem between the two test machines, and run netem on both interfaces (with differing parameters if you like).

The easiest way to achieve this is to run netem in a VM to route between two VM networks. I've found this to be quite handy.

MarkR