未找到CentOS 7 firewall-cmd

Modified on: Sun, 27 Oct 2019 14:00:02 +0800

我刚刚安装了CentOS 7:

[root@new ~]# cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core) 

我正在尝试配置防火墙,我被告知在CentOS 7中不再使用iptables,而是由firewalld取代。尝试运行命令以设置防火墙规则时:

firewall-cmd --add-port=80/tcp

我收到以下消息:

[root@new ~]# firewall-cmd --add-port=80/tcp
-bash: firewall-cmd: command not found

编辑:我也尝试了以下命令:

[root@new ~]# firewall-offline-cmd --add-port=80/tcp
-bash: firewall-offline-cmd: command not found

没有任何成功。

我尝试运行以下内容来检查firewalld是否已安装:

[root@new ~]# service firewalld status
Redirecting to /bin/systemctl status  firewalld.service
firewalld.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

在输出之后,我尝试启动firewalld:

[root@new ~]# service firewalld start
Redirecting to /bin/systemctl start  firewalld.service
Failed to issue method call: Unit firewalld.service failed to load: No such file or directory.

任何想法CentOS 7安装有什么问题?这是OpenVZ VPS上的干净安装,我还没有做任何改动。

作者:BnMcG

最佳答案

两种可能的选择

  • 您的PATH不包含/ usr / bin
  • 未安装firewall-cmd

    • yum install firewalld
作者:Iain

相关问答

添加新评论