iptables --tcp-フラグ

iptables --tcp-フラグ

Q1:次の規則は同じですか?

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

Q2:次の規則は同じですか?

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に触れ、いくつかのチュートリアルでこれら4つのルールを使用するよう提案したので、少し混乱しています。

ベストアンサー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.

おすすめ記事