复制内容到剪贴板
代码:
--tcp-flags [!] mask comp
Match when the TCP flags are as specified. The first argument
is the flags which we should examine, written as a comma-sepa-
rated list, and the second argument is a comma-separated list of
flags which must be set. Flags are: SYN ACK FIN RST URG PSH ALL
NONE. Hence the command
iptables -A FORWARD -p tcp --tcp-flags SYN,ACK,FIN,RST SYN
will only match packets with the SYN flag set, and the ACK, FIN
and RST flags unset.所以 ALL 理解为TCP的所有标志位更位准确,表示我们需要检查所有的标志位,相当于一个掩码;第二个参数指出的标志位是用来匹配的
/sbin/iptables -A INPUT -i eth0 -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
检查标志 S,R ;如果设置了就drop
/sbin/iptables -A INPUT -i eth0 -p tcp --tcp-flags ALL NONE -j DROP
检查所有的标志位,如果都没设置就drop