大网数据广告活动
服务器运维问答

How to drop packets based on length?

· 52CE 我爱测

could someone help to make iptables to drop all the packets with length 1006? Example: 18:33:18.964261 IP 74.209.87.132.3054 > 126.220.67.183.13806: UDP, length 1006

问题原文

原帖链接 · alfredogoncalves · CC BY-SA 4.0

could someone help to make iptables to drop all the packets with length 1006?

Example: 18:33:18.964261 IP 74.209.87.132.3054 > 126.220.67.183.13806: UDP, length 1006

社区高分解答

原帖链接 · Anton Danilov · CC BY-SA 4.0

You should use the length match. It supports the range of length.

To drop all udp packets with length 1006 bytes:

iptables -I INPUT -p udp -m length --length 1006 -j DROP

P.S.

  1. The iptables -m length --help shows the brief help of the length match.
  2. Read the iptables tutorial to understand of the basics.
  3. Other rules and order of the rules are very important.
  4. Better use the iptables-apply to safe change of the rule set (read the man).
  5. To troubleshoot check the rule counters.
  6. The tcpdump captures incoming packets before the iptables.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-07-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。