Scenario / Questions
I have just installed CentOS 7:
[root@new ~]# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core)
I am trying to configure the firewall, and I’m told that in CentOS 7 iptables is no longer used, replaced by firewalld. When attempting to run a command to set a firewall rule as such:
I receive the following message:
[root@new ~]# firewall-cmd --add-port=80/tcp -bash: firewall-cmd: command not found
edit: I tried the following command, too:
[root@new ~]# firewall-offline-cmd --add-port=80/tcp -bash: firewall-offline-cmd: command not found
without any success.
I tried running the following to check that firewalld was installed:
[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)
Following this output, I tried starting 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.
Any ideas what is wrong with the CentOS 7 install? This is a clean install on an OpenVZ VPS, I’m yet to make any changes at all.
Find below all possible solutions or suggestions for the above questions..
Two possible options
- Your PATH does not contain /usr/bin
- firewall-cmd is not installed
- yum install firewalld
Looks to me like you don’t have it installed/enabled.
yum install firewalld systemctl unmask firewalld systemctl enable firewalld systemctl start firewalld
Try the GUI tool instead, this util ships default with centos 6/7. firewalld is deprecated after centos5
$ sudo system-config-firewall
Disclaimer: This has been sourced from a third party syndicated feed through internet. We are not responsibility or liability for its dependability, trustworthiness, reliability and data of the text. We reserves the sole right to alter, delete or remove (without notice) the content in its absolute discretion for any reason whatsoever.
Source: CentOS 7 firewall-cmd not found