How To Stop The Firewall In Linux

5 min read

Stopping the firewall in Linux is a common task for system administrators, developers, and anyone troubleshooting network connectivity issues. On top of that, you need to understand which firewall service is active, how to stop it safely, and why stopping it temporarily differs from disabling it permanently. Whether you are using UFW on Ubuntu, firewalld on CentOS or Fedora, or raw iptables or nftables, the process involves more than just issuing a single command. This guide walks you through the exact commands for each major firewall system, explains the risks, and shows you how to verify that the firewall is truly inactive.

Understanding Linux Firewalls

Linux does not have a single built-in firewall. Instead, the kernel provides packet-filtering capabilities through Netfilter, and several user-space tools manage rules on top of it. The most common front-ends are:

  • UFW (Uncomplicated Firewall) – a simplified interface for iptables, default on Ubuntu and many Debian-based systems.
  • firewalld – a dynamic firewall manager with zones, default on RHEL, CentOS, Fedora, and Rocky Linux.
  • iptables – the classic rule-based firewall, still widely used and often present even when another front-end is installed.
  • nftables – the modern replacement for iptables, used by newer distributions.

Because these tools can coexist, stopping one may not stop another. Always check which service is actually controlling your firewall before making changes Took long enough..

Before You Stop the Firewall: Safety First

Stopping a firewall exposes your system to all network traffic, including potentially malicious scans and attacks. Before you proceed, take these precautions:

  • Confirm you have console or out-of-band access. If you are connected via SSH, stopping the firewall might not disconnect you, but re-enabling it incorrectly could lock you out.
  • Understand why you are stopping it. Temporary troubleshooting is fine; leaving a production server unprotected is not.
  • Note your current rules. Run sudo ufw status verbose, sudo firewall-cmd --list-all, or sudo iptables -L -n -v and save the output.
  • Plan to re-enable the firewall as soon as your task is complete.

How to Stop the Firewall in Linux Using UFW

UFW is the easiest firewall to manage. To stop it temporarily:

sudo ufw disable

This command stops UFW and removes its rules from the active packet filter. To confirm:

sudo ufw status

You should see Status: inactive. Note that ufw disable does not prevent UFW from starting at boot if it was previously enabled. To prevent it from starting automatically, you must also disable the service:

sudo systemctl disable ufw

To stop the UFW service directly without changing its boot status:

sudo systemctl stop ufw

Even so, systemctl stop ufw may not flush existing rules. The recommended way to fully stop UFW is sudo ufw disable.

How to Stop the Firewall in Linux Using firewalld

On systems using firewalld, stop the service with:

sudo systemctl stop firewalld

To prevent it from starting at boot:

sudo systemctl disable firewalld

Verify the status:

sudo systemctl status firewalld

You should see inactive (dead). Be aware that stopping firewalld does not necessarily flush all nftables or iptables rules that were loaded by firewalld. On the flip side, in most cases, stopping the service removes its active rules, but if you need a completely clean state, you may also need to flush the underlying ruleset manually. Use caution: flushing rules incorrectly can disrupt networking Worth keeping that in mind..

How to Stop the Firewall in Linux Using iptables

iptables is not a service in the same way as UFW or firewalld. It is a command-line tool that manipulates kernel packet-filtering rules. To “stop” iptables, you typically flush all rules and set default policies to ACCEPT:

sudo iptables -F
sudo iptables -X
sudo iptables -t nat -F
sudo iptables -t nat -X
sudo iptables -t mangle -F
sudo iptables -t mangle -X
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT

These commands delete all rules, delete custom chains, and set default policies to accept all traffic. This is a temporary change; rules will be restored after a reboot if they are saved in a configuration file or managed by a service.

If iptables rules are managed by a service such as iptables-persistent or netfilter-persistent, stop and disable that service:

sudo systemctl stop netfilter-persistent
sudo systemctl disable netfilter-persistent

How to Stop the Firewall in Linux Using nftables

nftables is the modern framework. To stop the nftables service:

sudo systemctl stop nftables
sudo systemctl disable nftables

To flush all nftables rules manually:

sudo nft flush ruleset

This removes all tables, chains, and rules. Verify with:

sudo nft list ruleset

An empty output means no rules are active. As with iptables, this change is temporary unless you also disable the service or remove saved configuration files.

Stopping vs. Disabling: What’s the Difference?

Many users confuse stopping a firewall with disabling it. The distinction matters:

  • Stopping ends the running service or removes active rules immediately. The firewall may start again after a reboot if it is enabled at boot.
  • Disabling prevents the service from starting automatically at boot. It does not necessarily stop a currently running instance.

For a complete shutdown, you usually need both: stop the service now and disable it for future boots. For temporary troubleshooting, stopping alone is sufficient and safer because the firewall returns after a reboot.

How to Verify the Firewall Is Stopped

Verification depends on the firewall tool:

  • UFW: sudo ufw status should show Status: inactive.
  • firewalld: sudo systemctl status firewalld should show inactive (dead).
  • iptables: sudo iptables -L -n should show empty chains with ACCEPT policies.
  • nftables: sudo nft list ruleset should return no output.

You can also test connectivity from another machine. So naturally, for example, try to connect to a port that was previously blocked. If the connection succeeds, the firewall is likely stopped Worth keeping that in mind. No workaround needed..

Re-enabling the Firewall

Once your troubleshooting or installation task is complete, re-enable the firewall immediately:

  • UFW: sudo ufw enable
  • firewalld: `sudo systemctl start firewalld
Keep Going

Just Came Out

Similar Ground

Covering Similar Ground

Thank you for reading about How To Stop The Firewall In Linux. We hope the information has been useful. Feel free to contact us if you have any questions. See you next time — don't forget to bookmark!
⌂ Back to Home