我错误地认为限制模块是每个源ip,但它似乎是基于所有请求:
577 36987 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmp type 8 limit: avg 3/sec burst 5
46 3478 LOG icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmp type 8 LOG flags 0 level 4 prefix `INET-PING-DROP:'
46 3478 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmp type 8
...
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmp type 8 limit: avg 3/sec burst 5
0 0 LOG icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmp type 8 LOG flags 0 level 4 prefix `WEB-PING-DROP:'
0 0 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmp type 8
如何根据源IP地址使用iptables / netfilter来限制icmp?
发布于 2011-07-15 23:59:16
如果你还想知道一个提示:
iptables -I INPUT -p icmp -m hashlimit --hashlimit-name icmp --hashlimit-mode srcip --hashlimit 3/second --hashlimit-burst 5 -j ACCEPT
假设输入中的最后一个规则是DROP,或者默认策略是drop。每个ip被限制为每秒3 ping(突发5)。并不是所有传入的IP都是总数,正如您在-m限制下所发现的那样。
https://serverfault.com/questions/290724
复制相似问题