Skip to content

How to enable/disable firewall on Ubuntu Linux

The default firewall on Ubuntu is ufw, which is short for “uncomplicated firewall.” Ufw is a frontend for the typical Linux iptables commands, but it is developed in such a way that basic firewall tasks can be performed without the knowledge of iptables.

Additionally, ufw can be managed from a graphical interface. In this tutorial, you will learn how to enable and disable the ufw firewall on Ubuntu from both command line and GUI.

In this tutorial you will learn:

  • How to check ubuntu firewall status
  • How to enable/disable ubuntu firewall
  • How to control firewall settings from GUI
How to enable/disable firewall on Ubuntu Linux
How to enable/disable firewall on Ubuntu Linux
CategoryRequirements, Conventions or Software Version Used
SystemUbuntu 16.04, 20.04, 22.04, 24.04 or higher
Softwareufw
OtherPrivileged access to your Linux system as root or via the sudo command.
Conventions# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to enable/disable firewall on Ubuntu step by step instructions


https://44db4a64393fd299f1da21791d13ee2f.safeframe.googlesyndication.com/safeframe/1-0-40/html/container.html

BASIC FACTS ABOUT UBUNTU FIREWALL
The Ubuntu firewall, managed through the Uncomplicated Firewall (UFW), offers a simple interface for configuring iptables. To check the current firewall status, use the command sudo ufw status. Enabling and disabling the firewall is straightforward with sudo ufw enable and sudo ufw disable. Specific ports can be opened with commands like sudo ufw allow 80 for HTTP, sudo ufw allow 443 for HTTPS, and sudo ufw allow ssh for SSH traffic. To allow ping (ICMP), you can configure UFW to permit this type of traffic with the command sudo ufw allow proto icmp. Turning off the firewall can be done with sudo ufw stop, rendering it inactive. These commands provide an effective way to manage network traffic and enhance system security on Ubuntu.

Enable or Disable Ubuntu firewall via command line

  1. The first thing we should do is open a command line terminal and check the ubuntu firewall status to see if it’s on or off with the following ubuntu firewall status command.$ sudo ufw status Status: active As seen here, our firewall is currently active (on). For more detailed output regarding your current firewall settings, add the verbose option.$ sudo ufw status verbose
  2. To disable the Ubuntu firewall, execute the following ubuntu firewall stop command.$ sudo ufw disable
  3. If you decide you need to enable the Ubuntu firewall again later, you can run the following ubuntu firewall enable command.WARNING
    Please note that by enabling your firewall, you may get disconnected if you are currently using SSH to remotely connect to your Ubuntu server.$ sudo ufw enable

Enable or Disable Ubuntu firewall via GUI

  1. To control ufw via GUI, you need to install the gufw package with the following command.$ sudo apt install gufw
  2. After installation, search for the gufw application in the Activities menu to open it.Search for and open the newly installed gufw application
  3. Simply click the Status toggle button in order to turn the ufw firewall on or off. After you are satisfied with the changes, you can close the application window. Your changes will take effect immediately.Toggle the ufw on or off via GUI

https://44db4a64393fd299f1da21791d13ee2f.safeframe.googlesyndication.com/safeframe/1-0-40/html/container.html

See the video below for more help.https://www.youtube.com/embed/LImC-1VU2_0

How to enable/disable firewall on Ubuntu Linux

Conclusion

In this tutorial, you learned how to enable or disable the system firewall (ufw) in Ubuntu. You also saw how to check the current status of the firewall using the ubuntu firewall status command. Typically, you won’t need to disable the firewall unless it’s for testing purposes or a specific requirement. It’s generally better to allow necessary ports through the firewall to maintain security while enabling required services.

Leave a Reply

Your email address will not be published. Required fields are marked *