How to configure a Firewall in Ubuntu Linux using UFW

firewall is one of the most important programs on our computer, it could be said that it is essential if it is used to surf the web, since it is designed to block unauthorized access, while allowing authorization to several servers. But if you are not yet familiar with them, we recommend that you investigate what they are, what they are for and how Firewalls work.

This is used to prevent internet users from accessing private networks connected to the internet . All information and messages that enter and leave a server go through a firewall, which examines each message and blocks those that do not comply with the specified security rules. You can even create inbound and outbound rules in the Firewall

Although Linux is one of the most secure operating systems, this does not mean that it is not vulnerable to malware. Although most Ubuntu users do not use firewalls, we recommend installing it, since it never hurts to have a little more security on our computer.

To do this, we are going to install the UFW firewall , which is super easy to configure and is already on the Linux UFW command line. It is available to all Ubuntu users.

Steps to install Firewall

 

Installing it is very simple, it has only 2 steps . There are two ways to do it, through software as such and through commands, unlike Windows when disabling the Firewall . The next steps are through the software directly.

Step 1

In order to install the software, it can be done by opening the Ubuntu software center, and in the search engine type “GUFW” and press “Enter”.

Step 2

The application will appear and you will see a button that says “Install”, click it. Then it will ask for your user password in order to install.

Optional step

Some people think that it is faster to install it by commands, if that is the case here is the command: sudo apt install gufw –y

Steps to configure

The setup, as well as the installation, is very easy and fast and it is only two steps. We will explain it in a simple way so that it is less tedious.

Step 1

Since UFW is installed, it is time to enable the firewall. To do this, open the application which can be found in the applications menu.

Step 2

After having opened the application we can see that it is deactivated. To activate it, go to the available options and you will see that there is one called “Status” and it has a button with “ON” and “OFF”.

After activating it, you will be able to activate any of the three pre-established security profiles. Let’s see what those three profiles are.

Preset security profiles

home

This is the preset profile that activates UFW when pressing “ON”. This profile has standard security rules and allows users to have more freedom when opening ports.

Public

This is the strictest preset profile available for the UFW firewall system. It has quite strict filtering characteristics. This profile is perfect for laptop users who often connect to public or high-traffic networks.

Office

The Office security profile for UFW is quite similar to “Home”, it has standard security and is good for setting special rules in your workplace.

Allow or deny traffic

Another of the UFW settings is to allow or deny traffic access through the firewall. Below we will briefly explain how you can configure it.

Step 1

See the option “Rules” , then click on it. Press the “+” option located at the bottom left of the application window.

Step 2

Now click on the “Preconfigure” tab and look for the option “Politic” and if you want to allow or deny access press “Allow” or “Deny” .

Step 3

You will be able to see the “Direction” option, press the option. Then set it to either “IN”, “OUT” or “BOTH”, depending on your needs and preferences.

Step 4

Finally go to the “Application” option , a menu list will appear to allow a particular application to be configured with the firewall. Select the “Add” option to add a new rule to the UFW Firewall, that’s it. The most important thing is the security of your files and data, that is why we recommend that you always have a firewall installed. Something interesting is that you can allow or block a program in the Firewall .

 

Leave a Comment