【问题标题】:Blocking web bots with iptables使用 iptables 阻止网络机器人
【发布时间】:2012-12-03 05:52:30
【问题描述】:

我试图阻止在短时间内打开大量连接的网络机器人。我正在使用这种语法:

-A INPUT -p tcp --dport 80 -m state --state NEW -m recent --set
-A INPUT -p tcp --dport 80 -m state --state NEW -m recent --update --seconds 1 --hitcount 20 -j logdropconnection

我的问题是我不能放松这些参数而不 iptables 抛出错误。当我尝试将命中数增加到 20 以上时,出现错误。我不应该可以将它设置为我想要的任何东西吗?例如,将我的连接限制为 100/秒?

【问题讨论】:

    标签: iptables


    【解决方案1】:

    由于您没有在问题中提及错误,我会大胆猜测dmesg 显示此错误:

    xt_recent: hitcount (100) is larger than packets to be remembered (20)

    这是xt_recent(有时称为ipt_recent)内核模块的设置。

    您可以通过更新(或创建)/etc/modprobe.d/options.conf 来增加限制:

    options xt_recent ip_pkt_list_tot=100

    注意:这可能是在具有内核共享功能的 VPS 主机上实现的问题。

    【讨论】:

    • 确实如此。我必须向我的 VPS 提供商开具支持票,才能让 xt_recent 在我的 vps 上工作。
    猜你喜欢
    • 2021-09-15
    • 2014-03-30
    • 2012-08-13
    • 2020-02-09
    • 1970-01-01
    • 2017-12-05
    • 2011-04-10
    • 1970-01-01
    • 2011-10-26
    相关资源
    最近更新 更多