How to enable disable firewall in Ubuntu

Ubuntu comes with a firewall configuration tool called UFW (Uncomplicated firewall). UFW is a convenient interface for managing firewall rules iptables, and its main goal is to simplify the management of firewall rules or, as the name implies, not complicate. It is highly recommended that you leave the firewall turned on. However, in some situations, such as testing, you may need to stop or disable firewall.



In this article, we will show you how to enable/ disable the UFW firewall. Before starting make sure you are logged in as a user with privileges sudo.

Checking the status of the firewall

To view the current status of the UFW firewall, use the ufw status command:
sudo ufw status
UFW firewall is disabled by default. If you have never activated UFW before, the output will show status as Inactive , Otherwise, if the firewall is turned on, you will see Active

Disabling Firewall

If you disable the firewall due to connectivity issues or have problems configuring the firewall, check out our guide on how to configure the firewall with UFW on Ubuntu. To disable the UFW firewall on your system Ubuntu use the ufw disable command:
sudo ufw disable
The output will look like this:
Firewall stopped and disabled on system startup
The above command will stop and disable the firewall, but will not remove the firewall rules. The next time you turn on the firewall, the same rules will be loaded.

Reset Firewall Rules

If you want to disable the firewall and remove all firewall rules, use the ufw reset command:
sudo ufw reset

Enabling the Firewall

Before turning on the firewall, make sure that the SSH port is open for connection.
To enable the firewall, run:
sudo ufw enable
Most UFW commands are intuitive and easy to remember. For example, ufw status shows the status of the firewall, and ufw disable disables the firewall.

0 Comments:

Post a Comment