本文共 1468 字,大约阅读时间需要 4 分钟。
How to make iptables/ip6tables configurations permanent across reboot on CentOS 7 ?
如何在CentOS 7 上重新启动时使iptables / ip6tables配置永久化?
CentOS 7 uses FirewallD by default. If you would like to manage iptables/ip6tables rules directly without using FirewallD, you may use the old good iptables-services
service which will load the iptables/ip6tables rules saved in /etc/sysconfig/iptables
and /etc/sysconfig/ip6tables
when it is started during boot time.
CentOS 7默认使用FirewallD。 如果您想不使用FirewallD直接管理iptables / ip6tables规则,则可以使用旧的良好iptables-services
服务,该服务将在/etc/sysconfig/iptables
和/etc/sysconfig/ip6tables
加载保存在其中的iptables / ip6tables规则在启动期间启动。
iptables-services
服务 (Enable iptables-services
service)# yum install iptables-services# touch /etc/sysconfig/iptables# touch /etc/sysconfig/ip6tables# systemctl iptables# systemctl start ip6tables# systemctl enable iptables# systemctl enable ip6tables
If the has FirewallD installed and enabled by default, you may disable the firewalld by
如果默认情况下安装并启用了FirewallD,则可以通过以下方式禁用firewalld
# systemctl disable firewalld.service# systemctl stop firewalld.service
Backup the configuration files before saving:
保存前备份配置文件:
# cp /etc/sysconfig/iptables /etc/sysconfig/iptables-date +%s# cp /etc/sysconfig/ip6tables /etc/sysconfig/ip6tables-date +%s
Then save the iptables rules:
然后保存iptables规则:
# iptables-save >/etc/sysconfig/iptables# ip6tables-save >/etc/sysconfig/ip6tables
翻译自:
转载地址:http://xfowd.baihongyu.com/