系统相关
首页 > 系统相关> > centos7,iptables的导出和重置

centos7,iptables的导出和重置

作者:互联网

默认情况下,iptables-save会导出所有的表和链到标准输出中

$ iptables-save
# Generated by iptables-save v1.4.21 on Mon Aug  8 10:51:28 2022
*nat
:PREROUTING ACCEPT [264:21272]
:INPUT ACCEPT [5:356]
:OUTPUT ACCEPT [403:30153]
:POSTROUTING ACCEPT [403:30153]
:OUTPUT_direct - [0:0]
:POSTROUTING_ZONES - [0:0]
:POSTROUTING_ZONES_SOURCE - [0:0]
:POSTROUTING_direct - [0:0]
:POST_public - [0:0]
:POST_public_allow - [0:0]
:POST_public_deny - [0:0]
:POST_public_log - [0:0]
:PREROUTING_ZONES - [0:0]
:PREROUTING_ZONES_SOURCE - [0:0]
:PREROUTING_direct - [0:0]
:PRE_public - [0:0]
:PRE_public_allow - [0:0]
:PRE_public_deny - [0:0]
:PRE_public_log - [0:0]
...

可以将它们输出到文件中

iptables-save > iptables_bak

想要再次进行恢复,iptables-restore即可:

iptables-restore <  iptables_bak

标签:iptables,PRE,重置,ACCEPT,POSTROUTING,centos7,save,public
来源: https://www.cnblogs.com/cosmos-wong/p/16563087.html