How to Set Up Firewall on Debian 12: Easy Guide

Don’t know how to set up Firewall on Debian 12? We’ve got your back!

A Firewall is a tool that monitors and controls incoming and outgoing network traffic based on specific security rules. More specifically, Debian 12 uses tools like UFW to configure and manage firewall settings.

These tools allow users to define rules for allowing or blocking traffic and enhance the overall security of the system against unauthorized access and cyber threats.

How to Set up Firewall on Debian 12

To setup a Firewall on Debian 12, follow the below steps:

Update the Debian repository using:

sudo apt update
Updating Debian repository

Install “ufw” using the below command:

sudo apt install ufw
Installing and setting up ufw firewall on Debian 12

After doing so, check the ufw version for the verification of Firewall installation:

sudo ufw version
Checking ufw version

Allow all SSH access to enable secure remote management of a server. It also makes it easier for administrators to perform tasks from anywhere: 

sudo ufw allow ssh
Allowing all ssh access

To check which ports are open, execute:

ufw show added
Viewing the ports added

Now, to see the firewall status, run:

sudo ufw status
Checking ufw status

In case, it is “inactive”, then activate it using the:

sudo ufw enable
Enabling firewall on Debian 12

In case, you want to uninstall the firewall, execute:

sudo apt remove ufw
Removing firewall from debian

Conclusion

In this guide, we demonstrated how to install and configure UFW on Debian. First, we updated the repository, then installed UFW, allowed SSH access for secure remote management, and checked open ports.

You can follow the given steps to effectively manage the network security of your server.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
Scroll to Top