skip to Main Content

When I try to add a port to FirewallsD, I get the following exception:

centos 7 answer FirewallD is not running

When I try to reload with

sudo firewall-cmd --reload

centos 7 answers FirewallD is not running
when I try to start with

sudo firewall-cmd --start

centos 7 answers FirewallD is not running

What can I do?

3

Answers


  1. Follow the below steps for the default installation of firewalld service in centos 7.

    First: firewalld is pre-installed in centos 7. If firewalld is not installed, install it. To verify and install, issue the below commands.

    rpm -qa firewalld
    # expected output: firewalld-0.6.3-2.el7_7.2.noarch
    
    # if not installed, install it
    yum install firewalld
    

    Second: firewalld mostly runs as a service. Check the service exists on the host.

    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
    

    Third: Verify firewalld service is running and enabled.

    If the service is running and it’s not enabled, every restart will bring it down. Use the below command.

    # 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
    
    Login or Signup to reply.
  2. First install and start firewalld service

    sudo yum install -y firewalld
    sudo systemctl start firewalld 
    

    Then start adding your rules with firewall-cmd command. Use –permanent flag to keep changes after system reboot.

    You may have to open ssh service if using remote SSH access.

    Then finally update firewalld with the new configuration

    sudo firewall-cmd --reload
    
    Login or Signup to reply.
  3. first check status of firewalld status by below command :

    sudo systemctl status firewalld
    

    if you get output Active: active so run the following command :

    sudo systemctl enable firewalld
    

    but if you get output Active: inactive (dead) or Loaded: masked (/dev/null; bad) follow the below commands :

    sudo systemctl unmask --now firewalld
    

    the output should indicate that the symlink has been removed.
    then run the below command :

    sudo systemctl enable firewalld
    

    after enabling the firewall, start the firewalld service:

    sudo systemctl start firewalld
    

    when the system executes the command, there is no output. Therefore, it is wise to verify whether the firewall has been activated successfully.

    check firewall status with:

    sudo systemctl status firewalld
    

    if you see the Active: active (running) message you can now do what you wanted to do.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search