Question

I am wondering how do I set a rule in my IPTables to drop packets from a specific IP address at a given probability of dropping.

Eg. for dropping any random packet from any IP, I would use the command:

# for randomly dropping 10% of incoming packets:
iptables -A INPUT -m statistic --mode random --probability 0.1 -j DROP

However, I want to drop a specific IP at a given probability.

Was it helpful?

Solution

Seems like you read this tutorial here. Have you tried this. Assuming your IP address is 123.456.78.90:

iptables -s 123.456.78.90/32 -A INPUT -m statistic --mode random --probability 0.1 -j DROP

Or perhaps:

iptables -s 123.456.78.90/32 -p tcp -m tcp -A INPUT -m statistic --mode random --probability 0.1 -j DROP
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top