How to check state of firewall on CentOS 7?

Posted by nikola, With 0 Comments, Category: Linux,

First of all - be careful not to stop firewall permanently. Stopping firewall is great security risk, and always check if your firewall is up, running and properly configured.

To check state of your firewall run next command:

firewall-cmd --state

If it's running, you will get very simple message:

running

Next, if you wand to stop firewall, run next:

systemctl stop firewalld

If you wand to start firewall, run:

systemctl start firewalld

If there is any case you need to disable firewall after you restart your server, run:

systemctl disable firewalld

And if you want to enable firewall, to be started in system boot, run:

systemctl enable firewalld.

Of course, if firewall is not properly configured, it can easily be like you don't have firewall at all, so be careful with that.