Categories: Tutorials

How To Disable and Stop Firewall on Linux(CentOS/Ubuntu)

This post will guide you how to disable Firewall on your CentOS 7 or CentOS 8 or Ubuntu Linux system. How do I Stop Firewalld or UFW service on your CentOS or Ubuntu Linux from the command line.

Sponsored
What is Firewalld


firewalld provides a dynamically managed firewall with support for network/firewall zones to define the trust level of network connections or interfaces. It has support for IPv4, IPv6 firewall settings and for ethernet bridges and has a separation of runtime and permanent configuration options. It also supports an interface for services or applications to add firewall rules directly.

What is UFW


UFW is used by Ubuntu and Debian Linux system for managing a netfilter firewall. This program is for managing a Linux firewall and aims to provide an easy to use interface for the user.

Checking Firewall Status


If you need to check the current status of the firewalld service or checking if a frewalld service is running or not in your CentOS or RHEL system, and you can use the following command:

$ sudo firewall-cmd --state

Or

$ systemctl status firewalld

outputs:

[devops@mydevops ~]$ sudo firewall-cmd --state
running
[devops@mydevops ~]$ systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2019-10-08 02:53:52 EDT; 6h ago
Docs: man:firewalld(1)
Main PID: 846 (firewalld)
Tasks: 2 (limit: 8297)
Memory: 31.0M
CGroup: /system.slice/firewalld.service
└─846 /usr/libexec/platform-python -s /usr/sbin/firewalld --nofork --nopid

Oct 08 02:53:50 mydevops.com systemd[1]: Starting firewalld - dynamic firewall daemon...
Oct 08 02:53:52 mydevops.com systemd[1]: Started firewalld - dynamic firewall daemon.

If you want to check if a UFW firewall is running or not on your Ubuntu or Debian based system, and you can use the following command:

$ sudo ufw status

Outputs:

devops@devops:~$ sudo ufw status
Status: active

Stopping Firewall


If you want to stop the firewalld service temporarily on your CentOS or RHEL Linux system, you can type the following command:

$ sudo systemctl stop firewalld

It is only valid for the current runtime session.

Sponsored

For Ubuntu or Debian Linux:

$ sudo ufw disable

Outputs:

devops@devops:~$ sudo ufw disable
Firewall stopped and disabled on system startup

Disabling Firewall


If you want to disable the firewalld service or UFW in CentOS or Ubuntu system at boot time, you can use the following command:

$ sudo systemctl disable firewalld

or

$ sudo ufw disable

Outputs:

[devops@mydevops ~]$ sudo systemctl disable firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[devops@mydevops ~]$

devops@devops:~$ sudo ufw disable
Firewall stopped and disabled on system startup

Enabling Firewall


if you want to enable the Firewall service or UFw based firewall on your CentOS or Ubuntu Linux system, and you can type the following command at the shell prompt:

$ sudo systemctl enable firewalld

or

$ sudo ufw enable

Outputs:

[devops@mydevops ~]$ sudo systemctl enable firewalld
Created symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service → /usr/lib/systemd/system/firewalld.service.
Created symlink /etc/systemd/system/multi-user.target.wants/firewalld.service → /usr/lib/systemd/system/firewalld.service.


devops@devops:~$ sudo ufw enable
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
Firewall is active and enabled on system startup

Conclusion


You should know that how to stop and disable the firewalld service or UFW based firewall in your CentOS or RHEL or Ubuntu Linux system.

The post How To Disable and Stop Firewall on Linux(CentOS/Ubuntu) first appeared on RSSFeedsCloud.

Ubuntu Server Admin

Recent Posts

Canonical Releases Ubuntu 25.04 Plucky Puffin

The latest interim release of Ubuntu introduces “devpacks” for popular frameworks like Spring, along with…

2 days ago

Ubuntu 25.04 (Plucky Puffin) Released

Ubuntu 25.04, codenamed “Plucky Puffin”, is here. This release continues Ubuntu’s proud tradition of integrating…

3 days ago

Extended Security Maintenance for Ubuntu 20.04 (Focal Fossa) begins May 29, 2025

Ubuntu released its 20.04 (Focal Fossa) release 5 years ago, on March 23, 2020. As…

3 days ago

Ubuntu 20.04 LTS End Of Life – activate ESM to keep your fleet of devices secure and operational

Focal Fossa will reach the End of Standard Support in May 2025, also known as…

4 days ago

Ubuntu MATE 25.04 Release Notes

Ubuntu MATE 25.04 is ready to soar! 🪽 Celebrating our 10th anniversary as an official…

5 days ago

Ubuntu Weekly Newsletter Issue 887

Welcome to the Ubuntu Weekly Newsletter, Issue 887 for the week of April 6 –…

6 days ago