kavin

CentOS 7.2下错误提示:Failed to start IPv4 firewall with iptables 解决方法

kavin linux 2018-11-20 5210浏览 0

前几天在配置ossec的时候要求不要使用centos7默认自带的firewall,需要使用iptables

然后停用firewall,重新安装iptables,配置规则后重启防火墙提示错误

Job for iptables.service failed because the control process exited with error code. See "systemctl status iptables.service" and "journalctl -xe" for details.

执行journalctl -xe查看错误日志,查到了更加具体的原因,错误如下:

Failed to start IPv4 firewall with iptables.


解决办法:


关闭firewalld:

systemctl stop firewalld
systemctl mask firewalld

使用iptables服务:

#开放443端口(HTTPS)

iptables -A INPUT -p tcp --dport 443 -j ACCEPT

#保存上述规则

service iptables save

#开启服务

systemctl restart iptables.service

一切正常。

(注意:在添加规则的时候一定要看清楚参数前面的符号编码问题,不然同样会出现这样的问题,致使服务器不能启动!)

发表评论