10

My firewall is currently inactive.

systemctl status firewalld firewalld.service Loaded: masked (/dev/null) Active: inactive (dead)

I used the following command to enable the firewall

# systemctl unmask firewalld 

but I got this error:

# systemctl unmask firewalld 
Failed to issue method call: Access denied

# sudo systemctl restart firewalld
Failed to issue method call: Unit firewalld.service failed to load: No such file or directory. 

# sudo systemctl enable firewalld 
Failed to issue method call: Access denied 
Ola Ström
  • 177
  • 1
  • 1
  • 6
MahuLovzYou
  • 111
  • 1
  • 1
  • 6
  • Is firewalld disabled in favor of iptables.service? Does `lsmod | grep iptab` show loaded modules? – Liczyrzepa May 16 '16 at 15:10
  • This might be a duplicate question - have a look here: [http://serverfault.com/questions/470287/how-to-enable-iptables-instead-of-firewalld-services-on-rhel-7-and-fedora-18](http://serverfault.com/questions/470287/how-to-enable-iptables-instead-of-firewalld-services-on-rhel-7-and-fedora-18) from that post: "This legacy package provides the systemd scripts for the previous iptables invocation." - in other words, even if firewalld is installed, the systemd config for it might not be. – sjlxndr May 16 '16 at 15:56

7 Answers7

5

solution

sudo systemctl unmask --now firewalld
sudo systemctl enable firewalld
sudo systemctl start firewalld
DmitrySemenov
  • 755
  • 2
  • 14
  • 27
4

Here's what worked for me.

Check for hanging firewalld proceses, e.g:

root  16278  1  4 Jan 13 ?  00:00:00 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

kill them and then:

# yum reinstall firewalld
# service unmask firewalld
# service enable firewalld
# service start firewalld

And of course, look in journalctl to see what happened earlier.

HiPeK
  • 41
  • 1
  • 2
3

This is highly recommended that you have a firewall protecting your server:

This error comes when you are trying to start or enable service which is either not installed on your Linux system or you typed an incorrect service name. See list of Services by typing:

systemctl list-units --type=service

Install if not available:

yum install firewalld

You can enable firewalld by typing:

systemctl enable firewalld
sudo systemctl enable firewalld

You can start firewalld by typing:

systemctl start firewalld
sudo systemctl start firewalld

Have a look to check its status by typing:

systemctl status firewalld
Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
Ramesh Chand
  • 251
  • 2
  • 10
0

If it's just for permissions then maybe you can try to

sudo su
systemctl enable firewalld
systemctl start firewalld
0

Also if you want to use iptables rather then firewalld as your firewall of choice on centos 7 see How to enable iptables (instead of firewalld) services on RHEL 7 and Fedora 18?, which includes the exact instructions on how to install and enable iptables for RHEL 7/centos 7.

Peter
  • 152
  • 5
0

Personally i prefer the old good iptables user space interface. So:

Initially disable firewalld. In your case this may be not necessary:

systemctl disable firewalld

Then install iptables:

yum install iptables-services

Enable iptables service:

systemctl enable iptables

Now you can save your rules as usual:

service iptables save
Vikelidis Kostas
  • 927
  • 1
  • 6
  • 15
0

The reason could be following link might be broken

/etc/systemd/system/firewalld.service -> /usr/lib/systemd/system/firewalld.service

create it manually by issuing following commands

ln -s /usr/lib/systemd/system/firewalld.service /etc/systemd/system/

Then enable the firewall and start

systemctl enable firewalld

[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2019-12-21 00:13:34 GMT; 2s ago
Docs: man:firewalld(1)
Main PID: 3020 (firewalld)
CGroup: /system.slice/firewalld.service
└─3020 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid

kenlukas
  • 2,886
  • 2
  • 14
  • 25