Securing your Debian system is necessary, and a vital step in achieving this is configuring a firewall. Uncomplicated Firewall or UFW offers a user-friendly way to control incoming and outgoing traffic, strengthening your system’s defense against unauthorized access and potential threats.
Here’s everything you need to know about installing, configuring, and effectively managing the firewall with UFW on your Debian system.

What Is UFW?
UFW or Uncomplicated Firewall is a user-friendly front-end for iptables andone of the best firewalls for Linux. You can easily install this firewall management tool ondifferent Linux distros, including Debian.
UFW simplifies the complex process of configuring iptables by providing a simplified interface and commands. This firewall enables you to define rules for handling network traffic. This makes sure that only authorized connections are allowed while blocking potential security risks.

A firewall is very different from an antivirus. To get into their key differences, refer to ourFirewall vs. Antivirus guide.
How to Install UFW on Debian
Before moving toward UFW configuration, install it on your Debian machine. For that, firstly, open a terminal and update the packages with:
Install UFW on Debian with:
Once UFW is installed, you can enable it with:
Defining UFW Rules on Debian
You can control the network traffic of your Debian system by defining some UFW rules. For instance, here is the description of some UFW rules:
Configuring the Default UFW Rules on Debian
To configure the default firewall rules on Debian, look at the given examples.
1. Allow All Outgoing Connections
By default, UFW blocks or denies all outgoing connections. However, you can allow them with:
2. Block or Deny All Incoming Connections
Execute the following command for blocking all incoming connections:
3. Allow a Specific Port
To allow the network traffic on the defined port with UFW, add the port number to the allow list:
Or the port name:
4. Deny a Specific Port
Similarly, deny the network traffic on any given port by using thedenymethod with the port number or name:
5. Allow IP Address
To allow traffic from a particular IP address, run:
6. Deny IP Address
You can also deny traffic from an IP address with:
7. Restart UFW
After defining the desired rules, simply restart UFW to apply all the changes:
8. Display UFW Status
Display the status of UFW and its active rules with:
9. Reset UFW Rules
To reset all UFW rules to default, run:
How to Uninstall UFW on Debian
You can easily uninstall UFW on Debian with:
Secure Your Debian System With UFW Firewall Mastery
Configuring a firewall is a fundamental step in securing your Debian system from potential security threats. UFW simplifies this process by providing an easy-to-use interface for the management of iptables rules.
By following the instructions provided, you can take control of your system’s network traffic. This guarantees that only authorized connections are allowed. Additionally, you can change the password of your Linux system to make it more secure.


