Javatpoint Logo
Javatpoint Logo

Ubuntu Disable Firewall

Ubuntu comes with a tool of firewall configuration which is known as UFW (means Uncomplicated Firewall). This tool is front-end and user-friendly to manage the rules of the iptables firewall and the primary objective of this tool is to enable handling the rules of the firewall easier or as its name defines uncomplicated.

It is suggested for keeping the firewall enabled. But, in some cases, like, testing we might need to disable or stop the firewall in our system. In this article, we will illustrate how to stop or disable the firewall on Ubuntu systems.

Before going deep into explanation, let's understand what is UFW.

What is UFW?

UFW (Uncomplicated Firewall) is a program to manage the Netfilter firewall developed to be easily used. It applies the command line interface composed of a small number of general commands and applies iptables for a configuration process. By default, this Netfilter firewall exists in each installation of Ubuntu after the 8.04 LTS version.

UFW in Ubuntu

The 8.04 version of Ubuntu introduced UFW. By default, it is available in each installations of Ubuntu.

Available Versions

  • 0.31.1-1: Ubuntu 12.04 ESM
  • 0.34-rc-0ubuntu2: Ubuntu 14.04 ESM
  • 0.35-0ubuntu2: Ubuntu 16.04 LTS
  • 0.36-0ubuntu0.18.04.1: Ubuntu 18.04 LTS
  • 0.36-6: Ubuntu 20.04
  • 0.36-7: Ubuntu 20.10
  • 0.36-7.1: Ubuntu 21.04
  • 0.36pre: Ubuntu Core

GUIs for UFW

GUI for GFW is intended to be an intuitive, easy, graphical user interface to manage an Uncomplicated firewall. Also, it supports basic tasks like blocking or allowing preconfigured, individual, or common P2P ports. Gufw has been developed for Ubuntu. However, it is available in the Arch Linux and Debian-based distros as well; anywhere GTK, Python, and UFW exist.

Advanced Functionality of UFW

The UFW application can do anything that an iptables could do. It is achieved via using various rule file sets. These files are nothing more as compared to the compatible text file, i.e., iptables-restore. Fine tuning UFW or/and adding other iptables commands are not offered by the UFW command:

  • /etc/default/ufw: This file is a high-level configuration like kernel modules, Ipv6 support, and default policies to use.
  • /etc/ufw/after[6].rules: The rules inside this file are analyzed after a rule added by the UFW command.
  • /etc/ufw/before[6].rules: The rules inside this file are analyzed before a rule is added by the UFW command.
  • /etc/ufw/sysctl.conf: This file addresses tunables for the kernel network.
  • /lib/ufw/user[6].rules or /var/lib/ufw/user[6].rules: In these files, the rules are added by the ufw command.
  • /etc/ufw/ufw.conf: It fixes whether or not the ufw application is enabled over a boot. In the 9.04 version or later, it fixes the LOGLEVEL.
  • /etc/ufw/before.init: In this file, the customization initialization script executes before the ufw application is initialized (ufw version 0.34 and later).
  • /etc/ufw/after.init: In this file, the customization initialization script executes after the ufw application is initialized (ufw version 0.34 and later).

Prerequisites

Ensure that we are logged in as root users along with the sudo privileges.

Check the Status of the Firewall

To check the latest UFW firewall status, we can use the following command:


Ubuntu Disable Firewall

By default, the UFW firewall is not enabled. If we have never started UFW before, then the result will look like the below:

Besides, if the firewall has been enabled, then we will see something like the below:

Disable the Firewall

We can use the following command for disabling the UFW firewall in our Ubuntu system:

The result will look like below:

Ubuntu Disable Firewall

The above command will disable or stop the firewall. However, it will not remove the rules of the firewall. Whenever we wish to enable this firewall, then similar rules would be loaded.

Delete the Firewall Rules

If we wish to stop the firewall and remove each rule of the firewall, then we can use the following command:


Ubuntu Disable Firewall

We will be asked whether we wish to proceed with the operation.

It is helpful to reset the UFW firewall when we wish to revert each of our modifications and begin fresh.

Enable the Firewall

Ensure that an SSH port is open for any connection before going to enable the firewall.

We can run the following command for enabling the firewall:


Ubuntu Disable Firewall

If prompted, enter y to proceed with the operation.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA