Uncomplicated Firewall (UFW) is the widely used and easiest command-line tool for handling the network. It is designed specifically for easy firewall configuration through simple commands that run on the terminal. These rules may include the configuration of ports, IPs, and incoming and outgoing connections like allowing and blocking them.
This firewall is not powerful as compared to iptables, but a good start for beginners who are less familiar with firewall concepts. Also, it has a graphical interface to manage firewalls and can be launched using gufw command.
Install and Setup UFW on Linux Mint 21
Here’s a step-by-step guide to show how to set-up UFW on Linux Mint 21 system:
Step 1: Upgrade the system repository to refresh all packages; this would avoid any conflict in the further process:
Step 2: For firewall configuration, you should have sudo privileges. Confirm with the help of the command if you’re working as the root user:
Step 3: Firewall is pre-installed in all Linux distributions and in case it is deleted or you don’t find it, type the command to install it on your system:
Step 4: Immediately enable the Firewall service using the mentioned command:
Step 5: Confirm the UFW status from the following command to check whether it is running successfully on your system:
Step 6: In the next move, you must enable the Firewall by yourself through the following command:
The above command activates the firewall setting on your Linux Mint system.
Display UFW Applications Profiles
To display all the present applications supported by firewall, type:
Let’s apply the rule to any of the above-mentioned applications; like to enable both HTTP and HTTPS server; type the following command:
The same command applies for other applications as well in case you want to apply rules on these applications.
Set Firewall Policies
The firewall has set the default policies by allowing the outgoing connections and denying the incoming connections for security purpose. In case if you want to set it by yourself, you can change the policies anytime.
For denying the incoming connections, you should apply the following command:
For allowing the outgoing connections, you must use the following command:
Enable Firewall on SSH Connections
You can also enable firewall on SSH connections to improve the system security and for this, you will require executing the following command:
Check UFW Status
You can display the status of all the applied rules on the firewall by executing the following command:
You can use the verbose flag command given below to display a detailed status update:
You can also view firewall status updates in a numeric sequence through the following command:
Setup UFW Firewall Through GUI
The UFW can also be configured using GUI and for this, you will require installing a tool called “gufw” on Linux Mint 21 system from the following command:
After the installation, launch it on the terminal by typing the command “gufw” and this command requires authentication to ensure you’re working as a root user:
Once you enter the correct credentials (password); the firewall screen will open in front of you and you can set the rules according to your choice:
This completes the setup of Firewall on Linux Mint system.
Conclusion
UFW is a popular and easy frontend tool to manage a Netfilter Firewall in a Linux system. Its aim is to make firewall configuration easier for beginners. This guide has mentioned all the necessary details of setting up UFW through different commands and GUI tools. It depends on the user’s choice of which method they want to adopt because both can be used to setup a firewall on Linux Mint system.