What is a Firewall? A firewall is a network security code that monitors the incoming and outgoing traffic inside the network. Simply we can say that a firewall is sort of a virtual barrier that’s placed so that the smallest amount of damage will occur. Thus the safe place is your non-public network and also the unsafe place is the internet which is a large public network. In this manner a firewall not solely eliminates unwanted network communication however, conjointly prevents the server from malicious attacks. There are 2 main kinds of firewalls, that is the host and the network firewall. A host firewall is put in on individual servers and monitors the incoming and outgoing connections. A network firewall is typically designed into the hosting infrastructure. It is essential to allow the firewall for Linux system. It is typically a normal belief that Linux is secure. Also, Linux systems are safe against viruses and different malicious entities, it’s vital to apply caution, particularly with the several cyber-crimes being committed. Ubuntu includes its own firewall known as uncomplicated firewall or ufw.

Enabling the ufw firewall in Ubuntu 20.04
By default, the firewall remains disabled. To allow the firewall, write down the following text.
$ sudo ufw enable

Now the firewall is enabled and it will start automatically as soon as the system boots. In the next step rewrite the sudo ufw status command and you will notice that the firewall is now active. Remember to reload the firewall after making changes with the ufw command to update the changes.
$ sudo ufw reload

Defining and Deleting Rules
In order to specifically open certain ports on the computer to the outside, thus it can be done with the help of allow option using port number. Like to explicitly permit the HTTP connections from other computers there is a need to enable the port 80.
$ sudo ufw allow 80

Instead of the port number, the service name can also be used. Now type the following command to allow the service of http.
$ sudo ufw allow http

Thus check the status of firewall. It shows that the status of port 80 is allowed.
$ sudo ufw status

Here we can see that port 80 allow the connections of the other computers.
Write the following command to remove the firewall rule that permits the connections on port 80:
$ sudo ufw delete allow 80

The below command is for temporary purpose and it can be closed without removing rule.
$ sudo ufw deny 80

Permit the connections from a particular IP Address
In order to choose the particular IP addresses to connect to your computer you have to write the following command. Like if you want to allow connections from the specific IP address (192.168.10.197), then run the command.
$ sudo ufw allow from 192.168.10.197

For deleting the IP address, select the specific that you want to remove and run the following command.
$ sudo ufw delete allow from 192.168.10.197

Conclusion
In this article I have shown you how to set up and configure a firewall in Linux Ubuntu 20.04. I have also shown you how to define and terminate rules in the firewall. Hope you enjoyed the article. Read more interesting articles on Techoreview.
Author Info:
My name is Akhunzada Younis Said. I am a software project manager in HAZTECH, a software engineering graduate, and a content writer. I love working with Linux and open-source software.