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 want to forward TCP connections on a certain port of the machine A to another port on the machine B (which is actually the same that originated the connection to machine A) and simulate random or deterministic packet drops.

How can I do it with iptables?

share|improve this question
    
I think scapy and hping will be more appropiate for that –  vnix27 Feb 28 '11 at 4:39

2 Answers 2

man what? right, man iptables:

statistic

This module matches packets based on some statistic condition. It supports two distinct modes settable with the --mode option.

or

random

This module randomly matches a certain percentage of all packets. --average percent Matches the given percentage. If omitted, a probability of 50% is set.

share|improve this answer

If using FreeBSD is an option ipfw in FreeBSD has got some excellent features to mimic various types of connections. It can add latency, packet loss etc. Very useful for testing WAN performance of an application.

There are commercial products to do this as well. I can recommend Linktropy, we use it extensively to test our in-house applications. The mini2 model only costs a few hundred USD and is enough for most usecases. http://www.apposite-tech.com/products/mini2.html

share|improve this answer

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.