How to check firewall status in Linux


To check the firewall status in Linux, you can use the following methods based on the firewall software being used:

Checking firewall status with ufw (Uncomplicated Firewall):

Open a terminal and run the following command to check the status of ufw:

sudo ufw status

If ufw is enabled, the output will show “Status: active” along with the firewall rules. If it is disabled, the output will show “Status: inactive”.

Checking firewall status with iptables (IPtables Firewall):

Open a terminal and run the following command to check the rules and status of iptables:

sudo iptables -L

The output will display the current firewall rules. If no rules are set, it indicates that the firewall is effectively inactive.

Checking firewall status with firewalld (Firewalld):

Open a terminal and run the following command to check the status of firewalld:

sudo firewall-cmd --state

If firewalld is enabled, the output will show “running”. If it is not running or not installed, you will see “not running” or an error message.

These methods should help you check the firewall status on your Linux system. Choose the appropriate method based on the firewall software you are using. Additionally, administrative privileges (sudo) might be required to run these commands.

Thanks for reading..