-
iptables -nL --line-number
顯示每條規則鏈的編號 -
iptables -D FORWARD 2
刪除FORWARD鏈的第2條規則,編號由上一條得知。如果刪除的是nat表中的鏈,記得帶上-t nat
-
iptables -D INPUT -j REJECT --reject-with icmp-host-prohibited
刪除規則的第二種方法,所有選項要與要刪除的規則都相同才能刪除,否則提示iptables: No chain/target/match by that name.
-
丟棄非法連接
iptables -A INPUT -m state --state INVALID -j DROP
iptables -A OUTPUT -m state --state INVALID -j DROP
iptables-A FORWARD -m state --state INVALID -j DROP