A firewall is like a guard for your computer. It decides which things from the internet can come in and which ones can't. It works with different kinds of internet stuff, like Ipv4 and Ipv6.
The firewall uses rules to make these decisions. These rules can be ones that come with the firewall or ones you make yourself. Every piece of internet stuff that tries to get in has to pass through this guard, and it checks if the rules say it's okay.
Each rule has a job, like saying what to do if the internet stuff doesn't follow the rules. In Linux, there are different firewall programs like firewalld that do this job.
What is Firewalld?
Firewalld is like a guardian for Linux computers. It helps decide what things from the internet can come in and go out.
It uses two types of rules: one is like a temporary rule, and the other is like a permanent one. The temporary rule goes away if the computer restarts, but the permanent one stays even if the computer restarts.
Firewalld has two folders for these rules: one is like a default folder [/usr/lib/firewall] that can get lost if the computer updates and the other is the important one [/etc/firewall] that always stays the same, even if the computer updates.
In this guide, we’ll see how to disable or enable the firewall in AlmaLinux, along with checking the status of the firewall. These are good troubleshooting options when determining if a firewall rule is blocking traffic to or from a particular service.
A) How to check the status of firewall on AlmaLinux
We can talk to the firewalld service using systemd. To check if firewalld is working right now, type this command in the terminal:
# systemctl status firewalld
The picture above tells us that firewalld is working now and will start when the computer turns on. We'll learn how to change that soon.
To find out what services firewalld is set up for, use this command:
# firewall-cmd --list-all
We can see that firewalld is set up for cockpit, DHCP, DNS, and SSH right now.
B) How to stop or start firewall on AlmaLinux
Here are simple steps to turn the firewall on or off using systemd commands:
To turn off the firewall, type this command:
# systemctl stop firewalld
You can make sure the firewall is off by checking its status.
Since the firewall is set to start when the computer boots up, it will stay off until you turn it on or restart your computer.
To turn the firewall back on, use this command:
# systemctl start firewalld
If you only need to restart the firewall without turning it off and on completely, you can do that too with this command:
# systemctl restart firewalls
C) How to permanently enable or disable firewall on AlmaLinux
Normally, the firewall starts by itself when your computer starts. But if you want to stop it from doing that forever, use this command:
# systemctl disable firewalld
If you change your mind and want the firewall to start again automatically, you can use this command:
# systemctl enable firewalld
Conclusion:
In conclusion, enabling or disabling the firewall on AlmaLinux is straightforward. By default, the firewall starts automatically when your system boots up. If you wish to disable it permanently, you can use the "systemctl disable firewalld" command. To re-enable the firewall, you can use the "systemctl enable firewalld" command.
Remember that having the firewall enabled provides an extra layer of security, so it's essential to carefully consider when and why you might want to disable it. Always prioritize your system's security needs when making these decisions.