1. 程式人生 > >解決CentOS(6和7版本),/etc/sysconfig/下沒有iptables的問題

解決CentOS(6和7版本),/etc/sysconfig/下沒有iptables的問題

name 命令 install star spa lib cep pro centos 6

一、Centos 6版本解決辦法:

1.任意運行一條iptables防火墻規則配置命令:

iptables -P OUTPUT ACCEPT  

2.對iptables服務進行保存:

service iptables save  

3.重啟iptables服務:

service iptables restart 

二、Centos 7版本解決辦法:

1、停止並屏蔽firewalld服務

systemctl stop firewalld
systemctl mask firewalld

2、安裝iptables-services軟件包

yum install iptables-services

3、在引導時啟用iptables服務

systemctl enable iptables

4、啟動iptables服務

systemctl start iptables

5、保存防火墻規則

service iptables save
或
/usr/libexec/iptables/iptables.init save

解決CentOS(6和7版本),/etc/sysconfig/下沒有iptables的問題