查看
iptables -t nat -nvL --line-numbers
iptables -t mangle -nvL --line-numbers
iptables -t raw -nvL --line-numbers
iptables -nvL --line-numbers # 不写默认是filter
iptables -t nat -nvL
iptables -t mangle -nvL
iptables -t raw -nvL
iptables -nvL
删除
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
# flush all chains
iptables -t nat -F
iptables -t mangle -F
iptables -F
# delete all chains
iptables -X
-F, --flush [chain]
Flush the selected chain (all the chains in the table if none is given). This is equivalent to deleting all the rules one by one.
-X, --delete-chain [chain]
Delete the optional user-defined chain specified. There must be no references to the chain. If there are, you must delete or replace the referring rules before the chain can be deleted. The chain must be empty, i.e. not contain any rules. If no argument is given, it will attempt to delete every non-builtin chain in the table.
疑惑:为什么不删raw表?
## anan
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
# flush all chains
iptables -t nat -F
iptables -t mangle -F
iptables -t raw -F
iptables -F
# delete all chains
iptables -t nat -X
iptables -t mangle -X
iptables -t raw -X
iptables -X
参考
参考:https://qastack.cn/server/200635/best-way-to-clear-all-iptables-rules