How to Fix UFW Not Working in Ubuntu?

Are you trying to work with the Uncomplicated Firewall in Ubuntu but are constantly met with various errors? If that is the case, then this guide is for you.

Uncomplicated Firewall (UFW) is a tool for security in Ubuntu, which includes installing firewalls, opening and closing ports for connectivity, managing types of connections that can be established on different ports, and much more. The UFW is available as a command-line and GUI tool in Ubuntu.

The UFW comes pre-installed in the newer version of Ubuntu. However, users can face errors while launching the “ufw” tool or enabling its firewall. Moreover, some users commonly face missing the GUI version of the UFW tool. Whatever the case is, this guide will show you the methods to fix UFW not working in Ubuntu.

Let’s get started!

How to Fix UFW Not Working in Ubuntu?

To fix the UFW command not working in Ubuntu, ensure that the UFW has been installed on your Ubuntu machine. After that, if the service status is “inactive,” and that is why your UFW is not working, you can use the “enable” command. To use the GUI UFW, you need to install it first.

Apart from all these errors, if your UFW is installed and active but not successfully blocking the connections or ports you would like, you need to configure the rules placed inside the UFW settings properly.

Let’s go over all of these solutions in detail!

Ensure UFW Installation

Even though the newer version of Ubuntu comes with a pre-installed version of the UFW tool, there is still a chance that your system is completely missing the UFW tool, which results in the “command not found” error. That is why you need to ensure that the UFW is installed on your Ubuntu system to ensure proper security and firewall.

To do this, open up a new terminal session on the Ubuntu machine (CTRL + ALT + T), execute the following command inside the terminal.

ufw

Upon executing the above command, the terminal will display the following message if the UFW is not installed on your Ubuntu machine.

How to Fix UFW Not Working in Ubuntu?

All you have to do is use the APT package manager to download and install UFW on your system. But before installing UFW, update your APT packages list by running the following command in the terminal.

sudo apt update

You will require sudo (root user) privileges to execute the above command. Therefore, type in the sudo password when the terminal prompts you.

How to Fix UFW Not Working in Ubuntu?

Once you have typed the password for the root user, press the “Enter” key, and the updating process will begin. After the APT packages list has been updated, install the UFW by running the following command inside the same terminal.

sudo apt-get install ufw

After the process, run the following command to ensure that UFW has been installed successfully on your system.

ufw --help

Upon successful installation of UFW, running the above command will show a list of arguments that can be used with the “ufw” command, ensuring the tool is working properly on your system.

How to Fix UFW Not Working in Ubuntu?

Enable UFW to Fix Inactive Status

If UFW is available on your Ubuntu status, but it keeps returning the inactive status or the firewall is not working as it is supposed to, then you can check the status of UFW and enable it in case of “inactive”.

To do this, you need to open a new terminal session on your Ubuntu machine and then type in the following command to view the status of the UFW service.

sudo ufw status

When you execute the command, the current status of the Firewall will be displayed as an output on the terminal.

How to Fix UFW Not Working in Ubuntu?

You need to run the following command to change the inactive status and make the firewall work in Ubuntu.

sudo ufw enable

By running this command, the firewall will become active and automatically start at the time of system boot. You will also get a conformational prompt on the terminal.

How to Fix UFW Not Working in Ubuntu?

Lastly, as an optional step, you can again use the status command to ensure that the UFW is active.

How to Fix UFW Not Working in Ubuntu?

By doing this, your UFW will start to work properly to block unwanted connections to your Ubuntu system.

Affordable VPS Hosting With Dracula Servers

Looking for reliable and budget-friendly Virtual Private Server (VPS) hosting? Look no further than Dracula Servers. Dracula Servers offers a range of VPS hosting plans tailored to meet diverse needs. With competitive pricing, robust performance, and a user-friendly interface, it’s an excellent choice for individuals and businesses alike.

Explore the Dracula Servers website to discover hosting solutions that align with your requirements and take your online presence to new heights with their affordable and efficient VPS hosting services.

Visit Dracula Servers and experience reliable VPS hosting without breaking the bank.

Configure UFW Rules Properly

If your UFW is active and still not working as it is supposed to, then chances are that the UFW is not configured properly. UFW works on rules that define which connections to block and which ports to open. Anything not present or defined in the rules will not work.

To fix this, you need first to view the current rules of your Firewall and then add new rules according to your requirements. Open up a new terminal and execute the following command to view the currently added rules in the Firewall.

sudo ufw show added

How to Fix UFW Not Working in Ubuntu?

As you can see from the output image, no rules have been added to the firewall. This happens when you have not previously used UFW on your current Ubuntu system. However, even if some rules are added to the firewall, ensure that they fulfill your requirements. Otherwise, you will have to add rules to it.

Suppose you want to add a rule that allows TCP traffic on port 6000,  you can use the following command.

sudo ufw allow 6000/tcp

You will get the following prompt on the terminal window upon successfully adding the rules to the firewall.

How to Fix UFW Not Working in Ubuntu?

If you want to enable Traffic from a specific IP address (for example, 204.112.11.34), use the following command.

sudo ufw allow from 204.112.11.34

Similarly, add as many rules as you want to configure the firewall. Once you are done, recheck the rules by running the “show added” command again.

How to Fix UFW Not Working in Ubuntu?

At this point, your UFW will start working properly and manage the security of your Ubuntu machine as per your needs.

Install Graphical UFW

If you are trying to avoid the command-line UFW and want to use the Graphical version of the tool, then you can opt for the GUFW. However, you might not be able to find it in the installed application of your Ubuntu system as it doesn’t have the Graphical tool pre-installed.

Therefore, you will have to install it before you can use it. To do this, open up a new terminal and execute the following commands.

sudo apt-get install gufw

After executing the above command, wait for the installation process to complete fully. Once done, you can access the Graphical UFW by clicking the Application Icon on the Desktop.

How to Fix UFW Not Working in Ubuntu?

Within the application drawer, use the search bar to find either “gufw” or “Firewall Configuration” and click on its icon.

How to Fix UFW Not Working in Ubuntu?

Accessing this application will require you to have the password to sudo users. When you click on the icon, a prompt box will appear for you to type the sudo password.

How to Fix UFW Not Working in Ubuntu?

After typing the password inside the prompt box, press the “Enter” key or the “Authenticate” button to launch the GUFW or Firewall Configuration app.

How to Fix UFW Not Working in Ubuntu?

With this Graphical Tool, you can configure the rules and easily set the firewall’s status as active or inactive.

Conclusion

The Uncomplicated Firewall (UFW) is a tool used to ensure security in Linux-based systems. This UFW tool mostly comes pre-installed in newer versions of Ubuntu but the status is set to inactive.

If you get the “command not found” error when you try to access the “ufw” tool using the command line, the UFW is not installed on your System. Therefore, install it using the APT or Snap package manager.

Otherwise, if the UFW is installed but not working, check the firewall status using the command “ufw status” and enable it if it is in an “inactive” state. Moreover, incorrect configuration of the rules will cause the firewall to not work according to your requirements.

Lastly, if you are trying to access the Graphical version of the UFW tool, you need to install it first using the apt package manager.

Check out More Linux Tutorials Here!

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
× Dracula Servers

Subscribe to DraculaHosting and get exclusive content and discounts on VPS services.