我想知道如何在我的IPTables中设置规则,以便在给定的丢弃概率下丢弃来自特定IP地址的数据包。
EG。为了从任何IP中删除任何随机数据包,我会使用命令:
# for randomly dropping 10% of incoming packets:
iptables -A INPUT -m statistic --mode random --probability 0.1 -j DROP
但是,我想以给定的概率删除特定的IP。
答案 0 :(得分:2)
好像你看过this tutorial here。你试过这个吗?假设您的IP地址为123.456.78.90
:
iptables -s 123.456.78.90/32 -A INPUT -m statistic --mode random --probability 0.1 -j DROP
或者也许:
iptables -s 123.456.78.90/32 -p tcp -m tcp -A INPUT -m statistic --mode random --probability 0.1 -j DROP