我正在尝试在 centos 7 机器上运行防火墙。我知道该服务是从 yum 安装的:
yum install firewalld
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.linuxfix.com
* epel: mirrors.develooper.com
* extras: mirror.sjc02.svwh.net
* remi: repo1.sea.innoscale.net
* remi-php56: repo1.sea.innoscale.net
* remi-safe: repo1.sea.innoscale.net
* updates: repos.lax.quadranet.com
Package firewalld-0.4.4.4-14.el7.noarch already installed and latest version
Nothing to do
但当我尝试启动它时,我得到了
Failed to start firewalld.service: Unit is masked.
这通常意味着它没有安装。因此我运行以下命令:
systemctl list-units --type=service
并且它没有被列出(它应该在 fail2ban 之后)
avahi-daemon.service loaded active running Avahi mDNS/DNS-SD Stack
chronyd.service loaded active running NTP client/server
crond.service loaded active running Command Scheduler
dbus.service loaded active running D-Bus System Message Bus
fail2ban.service loaded active running Fail2Ban Service
[email protected] loaded active running Getty on tty1
httpd.service loaded active running The Apache HTTP Server
iptables.service loaded active exited IPv4 firewall with iptables
irqbalance.service loaded active running irqbalance daemon
我已经卸载并重新安装了好几次,重新启动后结果还是一样。什么原因导致无法识别防火墙?我运行了 13 台虚拟机,只有这台虚拟机有这个问题。我也关闭了 selinux,但没用。欢迎提出任何诊断建议。
答案1
你试过了吗systemctl unmask firewalld
?这是启动屏蔽服务的第一步。
如果仍有问题,请检查是否存在空的覆盖目录/etc/systemd/system/firewalld.service.d
。如果覆盖目录存在但其中没有覆盖文件,则服务无法启动。在这种情况下,请删除该目录。