- ufw – Used by Ubuntu and Debian based system to manage the firewall.
- firewalld – Used by RHEL, CentOS and clones. It is a dynamic solution to manage the firewall.
Linux disable firewall command
Let us see how to stop and disable Firewalld on a CentOS or RHEL 7.x based system.
Is firewalld running on my system?
Run:
sudo firewall-cmd --state
Stop the the firewalld
Again, type:
sudo systemctl stop firewalld
Disable the FirewallD service at boot time
sudo systemctl disable firewalld
sudo systemctl mask --now firewalld
Verify that the FirewallD is gone
Simply type:
sudo systemctl status firewalld
Sample outputs:
* firewalld.service Loaded: masked (Reason: Unit firewalld.service is masked.) Active: inactive (dead) Apr 09 13:54:23 nixcraft-nuc systemd[1]: Starting firewalld - dynamic firewall daemon... Apr 09 13:54:24 nixcraft-nuc systemd[1]: Started firewalld - dynamic firewall daemon. Apr 16 23:34:29 nixcraft-nuc systemd[1]: Stopping firewalld - dynamic firewall daemon... Apr 16 23:34:29 nixcraft-nuc systemd[1]: Stopped firewalld - dynamic firewall daemon.
How do enable the firewalld again?
Simply run the following commands:
sudo systemctl unmask --now firewalld
sudo systemctl enable firewalld
sudo systemctl start firewalld
## verify that the firewalld started ##
sudo firewall-cmd --stateLinux disable ufw based firewall
ufw is easy to use app for managing a Linux firewall and aims to provide an easy to use interface for the user. It is the default on Ubuntu and can be installed on Debian, CentOS, and other Linux distros.
Is the ufw running?
The syntax is:
sudo ufw status
Stop the ufw on Linux
sudo ufw disable
Disable the ufw on Linux at boot time
sudo systemctl disable ufw
Verify that the ufw is gone
sudo ufw status
sudo systemctl status ufw
How do enable the ufw again?
Just issue the following two commands to enable the firewall and protect your box again:
sudo systemctl enable ufw
sudo ufw enable
## verify that ufw started ##
sudo ufw status
A note about older Linux distro
You need to use the service command and you must be a root user to run the following commands:
Stop the iptables service on Linux
service iptables stop
Disable the iptables service at boot time on Linux
# chkconfig iptables off