CentOS 7.2:Failed to start IPv4 firewall with iptables

本文涉及的产品
云防火墙,500元 1000GB
简介: CentOS 7.2:Failed to start IPv4 firewall with iptables

问题系统是centos7.2,且已经安装了iptables服务,但是在执行启动命令后,却报了iptables服务无法正常启动的错误。
启动命令如下:
systemctl start iptables.service
报错如下:
Job for iptables.service failed because the control process exited with error code. See "systemctl status iptables.service" and "journalctl -xe" for details.
两台服务器都是同样的环境,但是一台一切正常,另一台却是这种情况,觉得有点不对劲,之后尝试了几种其他方式,也试过重装iptables服务和重启服务器的方式,但是依然会报这个错误。
执行journalctl -xe查看错误日志,查到了更加具体的原因,错误如下:
Failed to start IPv4 firewall with iptables.
到这里大概知道问题的原因了。解决办法
因为centos7默认的防火墙是firewalld防火墙,不是使用iptables,因此需要先关闭firewalld服务,或者干脆使用默认的firewalld防火墙。
因为这次报错的服务器是一台刚刚购买的阿里云服务器,所以在操作上忘记关闭默认防火墙的步骤了才导致浪费了些时间在这件事情上。
关闭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
一切正常。

目录
相关文章
|
Linux
centos使用iptables实现nat端口转发
centos使用iptables实现nat端口转发
566 4
|
3月前
|
安全 Linux 网络安全
centos7中firewall防火墙的常用命令总结
以上命令集覆盖了 `firewalld`的基本操作,是维护CentOS 7系统安全不可或缺的工具。对于更高级的配置需求或遇到特定问题
70 3
|
安全 Linux 网络安全
百度搜索:蓝易云【服务器安全设置Centos7 防火墙firewall与iptables】
CentOS 7使用的默认防火墙是firewall,它是一种基于Netfilter的用户空间工具,用于管理Linux内核中的iptables规则。为了加强服务器的安全性,可以通过配置CentOS 7防火墙和iptables规则来保护服务器。
148 0
|
9月前
|
网络协议 Linux 网络安全
Centos7中如何打开和关闭防火墙??CentOS 7以上默认使用firewall作为防火墙改为iptables
Centos7中如何打开和关闭防火墙??CentOS 7以上默认使用firewall作为防火墙改为iptables
|
网络协议 Linux 网络安全
centos firewall 理解
centos firewall 理解
144 0
|
网络协议 Linux 网络安全
【Linux环境】centos7 Failed to start iptables.service: Unit not found 防火墙
【Linux环境】centos7 Failed to start iptables.service: Unit not found 防火墙
533 0
|
Shell Linux 开发工具
CentOS7安装oh-my-zsh(github start Top 10)
CentOS7安装oh-my-zsh(github start Top 10)
361 0
|
网络协议 Linux 网络安全
CentOS 7 :Failed to start IPv4 firewall with iptables.
CentOS 7 :Failed to start IPv4 firewall with iptables.
257 0
|
网络协议 Linux 网络安全
centOS firewall-cmd 防火墙
CentOS 7 中firewall-cmd命令  (2014-11-11 16:01:25) 转载▼ 标签:  股票   分类: linux 在 CentOS 7 暫時開放 ftp...
1262 0
|
4天前
|
监控 Linux PHP
【02】客户端服务端C语言-go语言-web端PHP语言整合内容发布-优雅草网络设备监控系统-2月12日优雅草简化Centos stream8安装zabbix7教程-本搭建教程非docker搭建教程-优雅草solution
【02】客户端服务端C语言-go语言-web端PHP语言整合内容发布-优雅草网络设备监控系统-2月12日优雅草简化Centos stream8安装zabbix7教程-本搭建教程非docker搭建教程-优雅草solution
52 20