Firewall is an important application that must be installed on your PC because it saves you from various types of malicious attacks and if you also have antivirus installed then both of them make sure that your PC is free of malicious contents.
You can install third party firewall in your Ubuntu but Ubuntu has got its own built in firewall which provides adequate protection to your system. The firewall in Ubuntu is known as Ufw short for uncomplicated firewall.
Ufw can perform basic function and also features a graphical user interface that will help you to set up the firewall. So we have prepared a guide for you that will enable you to configure the firewall easily. Read on to find out how.
How To Enable Firewall
1. The firewall is disabled by default you need to enable it by running the following command in the terminal sudo ufw enable
2. You can also add rules to firewall before enabling it so for example if you want to allow SSH traffic on port 22 then you can use one of the several commands as follows:
- sudo ufw allow 22 this command will allow both TCP and UDP traffic
- sudo ufw allow 22/tcp this command will only TCS traffic on this port
- sudo ufw allow ssh this command will check the /etc/services file on your system for the port SSH that requires it
3. If you want to block outgoing SSH traffic then use the following command sudo ufw reject out ssh
4. All the rules that you have created can be viewed by using the following command sudo ufw status
5. Suppose you want to delete a rule then you can add the word delete before the rule for example you can use this command sudo ufw delete reject out ssh
6. If you want to reset the firewall back to its default setting then use the following command sudo ufw reset
7. Ufw makes profiles for every application that connects to the net. So to view the application profile on your system use the following command sudo ufw app list
8. If you want to view detailed information about individual profiles and their rules the use the command sudo ufw app info Name
9. If you want to enable logging that will allow you to print firewall messages to system log then use the command sudo ufw logging on
How To Enable Graphical User Interface
The graphical user interface of the firewall isn’t installed by default. You can install the graphical user interface from the Ubuntu software center. You can use the following command to install it:
- sudo apt-get install gufw
After you have installed the GUFW it will appear as an application called Firewall Configuration. You can easily control the firewall with the interface. This interface makes it easy to add and edit rules without you using the terminal window.
So there you have an easy guide with which you can enable the Ufw on your Ubuntu. Do let us know what you think.