【问题标题】:IPTables How do I block a specific UDP Packet?IPTables 如何阻止特定的 UDP 数据包?
【发布时间】:2012-03-02 15:40:27
【问题描述】:

我想知道是否可以在 IPTables 中阻止这个特定的数据包?

IP (tos 0x0, ttl 122, id 59478, offset 0, flags [none], proto: **UDP** (17), **length: 32**) 49.125.39.7.53125 > 68.68.27.40.34535: UDP, **length 0**
    0x0000:  4500 0020 e856 0000 7a11 a086 317d 2707  E....V..z...1}'.
    0x0010:  4444 1b28 cf85 86e7 0008 0000 0000 0000  DD.(............
    0x0020:  0000 0000 0000 0000 0000 0000 0000

IP (tos 0x0, ttl  43, id 42852, offset 0, flags [none], proto: UDP (17), length: 32) 15.205.231.92.63002 > 68.68.27.40.18287: UDP, length 0
    0x0000:  4500 0020 a764 0000 2b11 91d3 0fcd e75c  E....d..+......\
    0x0010:  4444 1b28 f61a 476f 0008 0000 0000 0000  DD.(..Go........
    0x0020:  0000 0000 0000 0000 0000 0000 0000     

这是一种欺骗性的 DoS 攻击,使用随机源 IP 到随机目标端口,耗尽了我们的服务器应用程序所需的 udp 端口​​。我想根据 tcp 转储中突出显示的部分来阻止数据包,即最后的 UDP 长度:32 + 长度 0。这可能吗?

或者是否可以通过转储中的十六进制字符串来阻止数据包?

谢谢你, 弗洛伊德

【问题讨论】:

    标签: linux udp iptables centos5 netfilter


    【解决方案1】:

    IPTables 有一个u32 模块来测试从数据包中提取的最多 4 个字节的数量是否具有指定值。 您可能能够测试数据包是否是 DoS attachek。 下面是一个例子:

    iptables -A INPUT -j DROP -m u32 --u32 "16 & 0xFFFF = 0x4444"
    

    有关详细信息,请参阅 manpage of iptables(您应该在您的环境中使用 man iptables)。

    【讨论】:

    • 在centos5中是否有u32模块?
    • @Floyd,是的 u32 模块在 CentOS 5 中可用(我检查了我的 CentOS 5.3 主机)。请参阅man iptables 了解更多信息。
    • [root@dbox ~]# iptables -m u32 -h iptables v1.3.5: Couldn't load match u32':/lib/iptables/libipt_u32.so: cannot open shared object file: No such file or directory 我看到手册页中提到了 u32,但显然该模块缺少 CentOS 5.7,这是否意味着我必须重新编译内核?
    • 对不起,看来内核应该重新编译了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-20
    相关资源
    最近更新 更多