Checking Firewalld status
Want to check the firewalld status? The easiest way to check the status of firewalld is to use the following command:
sudo firewall-cmd --state
Want more details? I got you.
Check firewalld status in Linux
There are two ways you can check the status of the firewalld in Linux:
- Using the
firewall-cmd
command - Using the
systemctl
command
So let's start with the first one.
1. Using the firewall-cmd
command
The firewall-cmd is a command-line utility (of course) used to interact with the firewalld daemon and can be used to view the current firewall status, list/manage firewall rules, and of course, let you configure the firewalld as per your needs.
To use the firewalld-cmd
command to check the firewall status, use the following command:
Furthermore, if you want to list the current firewall configuration including allowed services, ports, and interfaces, you can use the firewalld-state
in the following manner:
firewall-cmd --get-active-zones
2. Using the systemctl
command
The best part of using this method is you're not required to use superuser privileges to check the firewalld status:
systemctl status firewalld.service
If you see the active (running)
, it simply means the firewalld is up and active.
Inactive Firewalld? Here's how to activate
If the firewalld is inactive, then here's how to activate the firewalld:
sudo systemctl start firewalld
But it will only start the firewalld for the current session. To start firewalld at every system boot, use the following:
sudo systemctl enable firewalld
Once done, you can check the status again.
Wrapping Up...
This was a quick tutorial on how to check firewalld status on Linux using two different methods. I find the systemctl command easy as I use systemd and it aligns well with my workflow.
I hope you will find this guide helpful.