A firewall protects a network by permitting or stopping data packets depending on security criteria. An effective firewall examines incoming traffic according to predefined criteria and prevents attacks by filtering questionable or unprotected data. Firewalls safeguard computer traffic at ports, where peripheral devices exchange data with a computer.
By deploying firewalls, you may prevent unwanted traffic from accessing your internal network perimeter from malicious sources, such as viruses and hackers. Therefore, this post will define a UFW firewall and demonstrate how to open a firewall port on Linux Mint.
What is Linux Mint’s UFW (Uncomplicated Firewall)?
UFW (Uncomplicated Firewall) is a straightforward and trustworthy firewall interface that includes a command-line interface for dealing with the firewall. UFW has several graphical user interface (GUI) tools that simplify system administration if you opt not to use the command-line interface. Thus, to install UFW through a terminal, you must type the command below:
sudo apt install ufw
After it is installed, you can verify to see if UFW is has been enabled or not by running the command below:
sudo systemctl status ufw
When you run the command above on the terminal, you will receive the active or inactive status.
As you’ve seen, the UFW is operational and functioning; the next phase is to configure the firewall to accept any application or port.
How to configure Linux Mint’s firewall to allow ports
Numerous tools in Linux communicate over ports, and SSH is among them. To open the OpenSSH port for outgoing and incoming communication, type this command:
sudo ufw allow openSSH
The firewall may prohibit communication due to port permissions, and if you wish to open the port for this cause, type this command:
sudo ufw allow 22/tcp
Note: By typing 22 again, you can see if these rules have indeed been implemented or not.
sudo ufw status verbose
You can stop or disable any specific communication port by executing the command below:
sudo ufw deny 22/tcp
And upon verification, you will receive the following status.
How to reset UFW
If you make an error, you can disable and revert the firewall to its default settings.
sudo ufw reset
A firewall protects a network by examining incoming and outgoing data packets and allowing or blocking them per security policies. Firewalls monitor inbound and outgoing network packets and decide whether or not to admit data packets based on a set of security criteria. This article explains how to use the UFW firewall in Linux Mint to open any specified port for communication.