1. 程式人生 > >CentOS 7 防火墻 出現Failed to start iptables.service: Unit iptables.service failed to load

CentOS 7 防火墻 出現Failed to start iptables.service: Unit iptables.service failed to load

entos code lang shell services strong imp centos 6 col

錯誤信息如下:

[root]# service iptables start
Redirecting to /bin/systemctl start  iptables.service
Failed to start iptables.service: Unit iptables.service failed to load: No such file or directory.
解決方法如下:

一直用CentOS 6 習慣了,一下沒適應過來。防火墻配置後執行service iptables save 出現”Failed to restart iptables.service: Unit iptables.service failed to load: No such file or directory.”錯誤,

在CentOS 7或RHEL 7或Fedora中防火墻由firewalld來管理,當然你可以還原傳統的管理方式。或則使用新的命令進行管理。

假如采用傳統請執行一下命令:

systemctl stop firewalld
systemctl mask firewalld

並且安裝iptables-services:
yum install iptables-services

設置開機啟動:
systemctl enable iptables

iptables啟動、關閉、保存:

systemctl [stop|start|restart] iptables
#or
service iptables [stop|start|restart]


service iptables save
#or
/usr/libexec/iptables/iptables.init save
 

CentOS 7 防火墻 出現Failed to start iptables.service: Unit iptables.service failed to load