(2011-2-27)iptables的数据包长度匹配模块

(2011-2-27)iptables的数据包长度匹配模块

编辑文章

记录一下linux下防火墙iptables xt_length,ko(MTU值)的匹配

本文HTML永久地址doc

iptables -A INPUT -p icmp --icmp-type 8 -m length --length 92 -j ACCEPT  --匹配MTU值刚好为92Bytes的封包
iptables -A INPUT -p icmp --icmp-type 8 -m length ! --length 92 -j ACCEPT  --匹配MTU值刚好不是92Bytes的封包
iptables -A INPUT -p icmp --icmp-type 8 -m length --length 92: -j ACCEPT   --匹配MTU值刚好大于等于92Bytes的封包
iptables -A INPUT -p icmp --icmp-type 8 -m length --length :92 -j ACCEPT   --匹配MTU值刚好小于等于92Bytes的封包
iptables -A INPUT -p icmp --icmp-type 8 -m length --length 50:92 -j ACCEPT    --匹配MTU值介于50~92Bytes的封包

MTU值=IP包头(20字节)+ICMP包头(8字节)+DATA 所以防火墙下面语句

iptables -A INPUT -p icmp --icmp-type 8 -m length --length 88 -j ACCEPT
iptables -A INPUT -p icmp --icmp-type 8 DROP

使用默认的ping是不能ping通的,只有使用下面方法

windows下:

ping -l 60 ipaddress

linux下:

ping -s 60 ipaddress

没有评论 :

发表评论