Emulating a network connection with packet drop

IP packet drop can be easily emulated on any section of network using a Linux Bridge and a single iptables command:

iptables -t mangle -A FORWARD -m statistic –mode random –probability 0.01 -j DROP

(where probability is expressed as a value between 0 and 1)

If the intention is to emulate packet drop to the local Linux system not using a bridge, use the INPUT chain:

iptables -t mangle -A INPUT -m statistic –mode random –probability 0.01 -j DROP

To remove the random packet drop and restore the connection to normal operation either change -A to -D in the above commands, or flush the iptables with:

iptables -t mangle -F FORWARD or iptables -t mangle -F INPUT

viaEmulating a network connection with packet drop.