Checking Firewall State in CentOS 7
How to make sure that you have activate firewall in your CentOS 7 which is mainly your currently used operating system in either can be your PC, laptop or server ?. Firewall function which is represented by firewalld service can actually be monitored by accessing several command. Below is the steps :
1. First of all, you have to know that you have to make sure the firewalld service has already been installed. You can read the following link to understand the steps.
If you just want to check whether or not the firewalld service has already been installed, just type the following command :
yum list installed | grep firewalld
or you can just type :
rpm -qa | grep firewalld
2. If the command failed, make sure you are now a root user. To check whether you are a root user or not, simply read this article to check who you are log into. If you don’t want to bother just type the following command :
There are generally two possibilities as the outcome of the above command.
1. You are not root.
2. You already root.
3. If you already root, skip this step. If you are not root, switch to root and read the following article in this link explaining in the details. If you just feel want to proceed directly, just type the following command :
su - root
If you don’t really understand what are the command above, for further explanation just read the article in this link. If you don’t care about it just proceed to the next step.
4. Oh well, you are already root and you still failed to execute the command properly, maybe you should check you internet connection or other things such as to make sure that your yum repository actually works.
5. We assume that you have already installed firewalld service as stated in step 1. Just execute the following command :
There are two possibilities of outcome from the execution of the above command :
2. not running
Below is the image depicts those possible outcomes :
The above image display the first state of firewalld service which is not running. By executing the following command :
systemctl start firewalld.service
Which is a command to activate or to start the firewalld.service, it is then actually changed the state of the firewalld service if executed the same command after starting the firewalld.service.
Below is the opposite condition of the previous image. It is the state of firewalld from running to not running.
Well there, if the output is one of the possible outcome stated above you have manage to check the state of your firewalld service correctly. If it is not, there might be something wrong with your firewalld service.
Another way to do it just by typing the following command :
systemctl status firewalld.service
There are also two possibilities of outcome which is described with the following images :
- Active, described as shown in the following image :
- Inactive, described in the following image :