问题1:下列规则相等吗?
iptables -t raw -A PREROUTING -p tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP
iptables -t raw -A PREROUTING -p tcp --tcp-flags ALL NONE -j DROP
问题2:下列规则相等吗?
iptables -t raw -A PREROUTING -p tcp --tcp-flags FIN,SYN FIN,SYN -j DROP
iptables -t raw -A PREROUTING -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
我是 iptables 的新手,我有点困惑,因为一些教程建议使用这四个规则。
答案1
是的,这两个问题都适用。
ALL
是相同的FIN,SYN,RST,PSH,ACK,URG
。
查看使用TCP协议时使用的man iptables-extensions
命令: 。--tcp-flags
-p tcp
[!] --tcp-flags mask comp
Match when the TCP flags are as specified. The first argument
mask is the flags which we should examine, written as a comma-
separated list, and the second argument comp is a comma-sepa‐
rated 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.