首页 > 解决方案 > 防火墙未运行

问题描述

当我尝试向 FirewallsD 添加端口时,出现以下异常:

centos 7 answer FirewallD is not running

当我尝试重新加载时

sudo firewall-cmd --reload

centos 7 answers 当我尝试开始时 FirewallD 没有运行

sudo firewall-cmd --start

centos 7 answers FirewallD 没有运行

我能做些什么?

标签: centos7firewalld

解决方案


按照以下步骤firewalld在centos 7中默认安装服务。

首先firewalld在centos 7中是预装的。如果firewalld没有安装,安装它。要验证和安装,请发出以下命令。

rpm -qa firewalld
# expected output: firewalld-0.6.3-2.el7_7.2.noarch

# if not installed, install it
yum install firewalld

第二firewalld主要作为服务运行。检查主机上是否存在服务。

ll /usr/lib/systemd/system | grep firewalld
# expected output: -rw-r--r-. 1 root root 674 Jan 30 2018 firewalld.service
# OR
ll /etc/systemd/system | grep firewalld

第三:验证 firewalld 服务正在运行并启用。

如果服务正在运行且未启用,则每次重新启动都会将其关闭。使用以下命令。

# check the status of the service (running and enabled)
systemctl status firewalld

# if the service is not running, start it
systemctl start firewalld

# if the service has exited, restart it(check for error if any)
systemctl restart firewalld

# if the service is not enabled, enable it
systemctl enable firewalld

推荐阅读