centos7,iptables的导出和重置

2022/8/9 5:23:00

本文主要是介绍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


这篇关于centos7,iptables的导出和重置的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程