Centos7启动防火墙时Failed to start firewall.service: Unit not found.

文章目录

  • 问题描述
  • 问题出现的原因
  • 其他命令

问题描述

想在centos下开放端口结果在启动防火墙时出现问题了
启动防火墙时遇到的问题如下:

[root@ecs-d5cf-0015 ~]# systemctl start firewall.service
Failed to start firewall.service: Unit not found. 

问题出现的原因

没有安装firewalld
依次输入下列命令
(使用yum install firewalld命令安装时,中间停顿输入y既可)

yum install firewalld
systemctl unmask firewalld
systemctl enable firewalld
systemctl start firewalld

其他命令

systemctl start firewalld.service //开启防火墙
systemctl stop firewalld.service //关闭防火墙
systemctl enable firewalld.service //设置开机自动启动
systemctl disable firewalld.service //设置关闭开机制动启动
firewall-cmd --reload //在不改变状态的条件下重新加载防火墙

你可能感兴趣的:(Centos7启动防火墙时Failed to start firewall.service: Unit not found.)