从iptables阻塞连接多久? 有没有办法设置超时?

iptables -A INPUT -m state --state NEW -m recent --set # If we receive more than 10 connections in 10 seconds block our friend. iptables -A INPUT -m state --state NEW -m recent --update --seconds 5 --hitcount 15 -j Log-N-Drop 

我从iptables有这两个相关的规则。 如果超过15个连接在5秒内完成,则logging尝试并将其阻止。 iptables维护柜台多久? 如果再次尝试连接,它会刷新吗?

如果超过15个连接在五秒钟内完成,它们的连接将被拒绝,直到收到最后一个数据包后五秒。

你可以通过运行iptables -m recent --help来获得这个模块的帮助:

与您的问题有关的主要选项是:

 [!] --update Match if source address in list, also update last-seen time. 

所以我的理解是,更新它会刷新,但你需要在更新之前更新。 因此,如果它是第一个将会“过期”。 作者页面上的示例也可能有帮助。 如果更多的IP来了,下面的模块参数也会起作用:

ip_list_tot = 100; 每桌记住的地址数量

编辑:老实说,更多的思考我对所有可能的scenerios有点困惑。 我会testing这个很多通过制作不同的来源IP地址与scapy fping的东西。 以下模块参数也可能有所帮助:

 debug=0 ; Set to 1 to get lots of debugging info 

也许有人会有更好的答案谁已经尝试过的select,对不起: – /