There is nothing safe from hackers on the Internet, however, we can implement security measures to be more protected against an attack. With this in mind, it is convenient to configure a firewall in our system.
A Firewall is a system that allows protecting a computer or a network of the intrusions that come from the Internet. A firewall behaves as a barrier between the Internet or other public networks and our computer. In the firewall, the incoming and outgoing connections are determined by established rules.
For this reason, it is convenient to take some time to adjust the behavior of the Firewall in the system. Today I will teach you how to configure a firewall in Ubuntu 20.04 / Debian 10.
Configure the Firewall in Ubuntu 20.04 / Debian 10
1.-Upgrade the system
Upgrading the system is always a vital task to perform these types of installations and configurations because doing so provides us with the latest security patches. In short, you’ll have a more secure system. To do this, open a terminal and write:
:~$ sudo apt update && sudo apt upgrade
As a result of updating the system, you will be able to work with the firewall with the certainty of having more updated and more stable packages.
2. Working with UFW the Firewall on Ubuntu 20.04 / Debian 10
By default, Ubuntu has a Firewall installed, but not configured. In other words, it’s almost like not having it. So you have to get to work on it.
First of all, you must enable the service. Without it, the firewall will not run.
:~$ sudo systemctl enable ufw :~$ sudo systemctl start ufw
Now, it’s a good idea to see ufw’s default rules for the system. In this case, run:
:~$ sudo ufw show raw
If you plan to use a server, then it’s a good idea to allow connections from ssh.
:~$ sudo ufw allow ssh
In effect, the above command, tells the Firewall to allow input and output connections to ssh.
In case you want to “open” a port to be used by another application, you must run:
:~$ sudo ufw allow 321/tcp
Don’t forget to replace 321 with the port you want. If the application uses TCP or UDP, you must change as the case may be.
You can open as many ports as you need. However, these three are basic to working with the computer:
:~$ sudo ufw allow 80/tcp :~$ sudo ufw allow 443/tcp :~$ sudo ufw allow 21/tcp
80/TCP: Used for HTTP
443/TCP: Used for HTTPS
21/TCP: Used for FTP
You can even make a rule to allow or deny connections from any IP address.
:~$ sudo ufw allow from IP
With this, you authorize that the applications that come from that IP the firewall will accept them. If the IP address cannot be located, you will see an error like this:
If you are sorry to allow connections to that IP, you can revoke the rule:
:~$ sudo ufw deny IP
Remember to replace “IP” with the corresponding IP address.
However, imagine you’re starting to build a network and you don’t know who to trust, so you can deny connections from all computers.
:~$ sudo ufw deafult deny incoming
It is also possible to list all the options that the firewall has. Show them with the following command:
:~$ sudo ufw --help
As can be seen, manipulating ufw from the terminal is very simple.
3. GUFW. A graphical program to configure the firewall in Ubuntu 20.04 / Debian 10
As can be seen, manipulating ufw from the terminal is very simple, but if you don’t feel comfortable using CLI, then it is possible to use a GUI for it.
With GUFW, you can configure a firewall on Ubuntu easily. Also, you can apply the same options, but with a convenient graphical management interface. To install it:
:~$ sudo apt install gufw
When you run it, you’ll see a very simple interface like this:
If you click on “Rules” and then on the “+” button you can add the rules we have done before per terminal. Remember to first enable the GUFW.
You can also check the logs that are generated.
As you can be seen, configure a firewall in Ubuntu is simple and provides us with the extra security needed for an operating system. Of course, if we speak at the enterprise level, there are even more customizable and payment solutions to further protect the security of businesses.
Now it’s up to you, tell us about your experience with ufw?
Conclusion
Computer security is not something to be taken lightly, which is why knowing how to configure a firewall is always a good idea. Even in operating systems as safe as Linux or BSD.
Now, with this post, you have the basic tools to configure a Firewall in a fast and easy way and have a more secure system.
Please share this article on your social networks and join our Telegram Channel.
Unable to pull up GUFW. Updated ufw and still no response, any suggestions would be appreciated.