• About Us
  • Disclaimers
  • Privacy Policy
  • Sitemap
Linux Tutorials for Beginners
Advertisement
  • Ubuntu
    Install and Secure phpMyAdmin on Ubuntu 22.04

    How To Install and Secure phpMyAdmin on Ubuntu 22.04

    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on Ubuntu 22.04

    Install Uptime Kuma on Ubuntu 22.04

    How To Install Uptime Kuma on Ubuntu 22.04

    Install Ubuntu Server 22.04

    How To Install Ubuntu Server 22.04 LTS with Screenshots

    Set Up Firewall on Ubuntu 22.04

    How To Set Up a Firewall with UFW on Ubuntu 22.04

    Install Nginx on Ubuntu

    How To Install Nginx on Ubuntu 22.04: A Comprehensive Guide

    Install MySQL 8.0 on Ubuntu 22.04

    How To Install MySQL 8.0 on Ubuntu Server 22.04

    install-php74-ubuntu2204

    How To Install PHP 7.4 on Ubuntu 22.04

    Install Snipe-IT on Ubuntu 22.04

    How To Install Snipe-IT Asset Management on Ubuntu 22.04

  • Debian
    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on Debian 11

    Install Debian 11 Server

    How To Install Debian 11 (Bullseye) Server with Pictures

    Install and Setup Node.js on Debian 11

    How To Install and Setup Node.js on Debian 11

    Install PHP 8.2 on Debian 11

    How To Install PHP 8.2 on Debian 11

    Install Nginx on Debian 11

    How To Install Nginx on Debian 11: A Comprehensive Guide

    Set Up Firewall with UFW on Debian

    How To Set Up a Firewall with UFW on Debian 11

    install php74 on debian 11

    How To Install PHP 7.4 on Debian 11

    Install MariaDB 10.9 on Debian 11

    How To Install MariaDB 10.9 on Debian 11 Server

    Initial Setup Debian Server

    Initial Setup Debian 11 Server: Secure and Efficient

  • Rocky Linux
    Install phpMyAdmin on Rocky Linux 9

    How To Install phpMyAdmin on Rocky Linux 9

    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on Rocky Linux 9

    Install Rocky Linux 9.2 Server

    How To Install Rocky Linux 9.2 Server with Screenshots

    setup Firewall Using Firewalld Rocky Linux 9

    How To Set Up a Firewall Using FirewallD on Rocky Linux 9

    Install Nginx on Rocky Linux 9

    How To Install Nginx on Rocky Linux 9: A Comprehensive Guide

    Install Apache on Rocky Linux

    How To Install and Configure Apache on Rocky Linux 9

    Install MongoDB on Rocky Linux 9

    How To Install MongoDB 6.0 on Rocky Linux 9

    Install Docker on Rocky Linux

    How To Install Docker CE on Rocky Linux 9

  • CentOS
    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on CentOS 7

    Install PHP8.2 on CentOS 7

    How To Install PHP 8.2 on CentOS 7 / RHEL 7

    Install Apache on CentOS 7

    How To Install Apache Web Server on CentOS 7

    Set Up FirewallD on CentOS 7

    How To Set Up a Firewall Using FirewallD on CentOS 7

    Initial Setup CentOS 7 Server

    Initial Setup CentOS 7 Server: Secure and Efficient

    Install Nginx on CentOS 7

    How To Install Nginx on CentOS 7: A Comprehensive Guide

    Build NGINX from Source on Centos 7

    How To Build NGINX from Source (Compile) on Centos7

    Install Docker Swarm on CentOS 7

    Install and Configure Docker Swarm Mode on Centos 7

    Install Docker Compose on Centos 7

    How To Install and Use Docker Compose on Centos 7

  • Linux
    Manage Groups on Linux

    A Simple Guide: How To Manage Groups on Linux

    Logrotate In Linux

    How To Manage Log Files Using Logrotate In Linux

    Check File Size in Linux

    The Easy Ways to Check File Size in Linux

    Linux server security system administrators

    Best Practices Linux Server Security for System Administrator

    Backup Files From Remote Linux VPS Using Rsync Script

    How To Backup Files From Remote Linux VPS Using Rsync Script

    SSH Key-based Authentication

    How To Configure SSH Key-based Authentication In Linux

    Linux File Permissions

    Understanding Linux File Permissions for Beginners

    Create Multiboot USB with Ventoy

    How To Create Multiboot USB with Ventoy in Linux

    Find Hard Disk Drive Information in Linux

    How To Find Hard Disk Drive Information in Linux

No Result
View All Result
Linux Tutorials for Beginners
  • Ubuntu
    Install and Secure phpMyAdmin on Ubuntu 22.04

    How To Install and Secure phpMyAdmin on Ubuntu 22.04

    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on Ubuntu 22.04

    Install Uptime Kuma on Ubuntu 22.04

    How To Install Uptime Kuma on Ubuntu 22.04

    Install Ubuntu Server 22.04

    How To Install Ubuntu Server 22.04 LTS with Screenshots

    Set Up Firewall on Ubuntu 22.04

    How To Set Up a Firewall with UFW on Ubuntu 22.04

    Install Nginx on Ubuntu

    How To Install Nginx on Ubuntu 22.04: A Comprehensive Guide

    Install MySQL 8.0 on Ubuntu 22.04

    How To Install MySQL 8.0 on Ubuntu Server 22.04

    install-php74-ubuntu2204

    How To Install PHP 7.4 on Ubuntu 22.04

    Install Snipe-IT on Ubuntu 22.04

    How To Install Snipe-IT Asset Management on Ubuntu 22.04

  • Debian
    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on Debian 11

    Install Debian 11 Server

    How To Install Debian 11 (Bullseye) Server with Pictures

    Install and Setup Node.js on Debian 11

    How To Install and Setup Node.js on Debian 11

    Install PHP 8.2 on Debian 11

    How To Install PHP 8.2 on Debian 11

    Install Nginx on Debian 11

    How To Install Nginx on Debian 11: A Comprehensive Guide

    Set Up Firewall with UFW on Debian

    How To Set Up a Firewall with UFW on Debian 11

    install php74 on debian 11

    How To Install PHP 7.4 on Debian 11

    Install MariaDB 10.9 on Debian 11

    How To Install MariaDB 10.9 on Debian 11 Server

    Initial Setup Debian Server

    Initial Setup Debian 11 Server: Secure and Efficient

  • Rocky Linux
    Install phpMyAdmin on Rocky Linux 9

    How To Install phpMyAdmin on Rocky Linux 9

    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on Rocky Linux 9

    Install Rocky Linux 9.2 Server

    How To Install Rocky Linux 9.2 Server with Screenshots

    setup Firewall Using Firewalld Rocky Linux 9

    How To Set Up a Firewall Using FirewallD on Rocky Linux 9

    Install Nginx on Rocky Linux 9

    How To Install Nginx on Rocky Linux 9: A Comprehensive Guide

    Install Apache on Rocky Linux

    How To Install and Configure Apache on Rocky Linux 9

    Install MongoDB on Rocky Linux 9

    How To Install MongoDB 6.0 on Rocky Linux 9

    Install Docker on Rocky Linux

    How To Install Docker CE on Rocky Linux 9

  • CentOS
    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on CentOS 7

    Install PHP8.2 on CentOS 7

    How To Install PHP 8.2 on CentOS 7 / RHEL 7

    Install Apache on CentOS 7

    How To Install Apache Web Server on CentOS 7

    Set Up FirewallD on CentOS 7

    How To Set Up a Firewall Using FirewallD on CentOS 7

    Initial Setup CentOS 7 Server

    Initial Setup CentOS 7 Server: Secure and Efficient

    Install Nginx on CentOS 7

    How To Install Nginx on CentOS 7: A Comprehensive Guide

    Build NGINX from Source on Centos 7

    How To Build NGINX from Source (Compile) on Centos7

    Install Docker Swarm on CentOS 7

    Install and Configure Docker Swarm Mode on Centos 7

    Install Docker Compose on Centos 7

    How To Install and Use Docker Compose on Centos 7

  • Linux
    Manage Groups on Linux

    A Simple Guide: How To Manage Groups on Linux

    Logrotate In Linux

    How To Manage Log Files Using Logrotate In Linux

    Check File Size in Linux

    The Easy Ways to Check File Size in Linux

    Linux server security system administrators

    Best Practices Linux Server Security for System Administrator

    Backup Files From Remote Linux VPS Using Rsync Script

    How To Backup Files From Remote Linux VPS Using Rsync Script

    SSH Key-based Authentication

    How To Configure SSH Key-based Authentication In Linux

    Linux File Permissions

    Understanding Linux File Permissions for Beginners

    Create Multiboot USB with Ventoy

    How To Create Multiboot USB with Ventoy in Linux

    Find Hard Disk Drive Information in Linux

    How To Find Hard Disk Drive Information in Linux

No Result
View All Result
Linux Tutorials for Beginners
No Result
View All Result

Home » Debian » How To Set Up a Firewall with UFW on Debian 11

How To Set Up a Firewall with UFW on Debian 11

sammbysamm
October 17, 2023
Set Up Firewall with UFW on Debian

How To Set Up Firewall with UFW on Debian 11

Share on FacebookShare on LinkedinShare on Whatsapp

When it comes to securing your Debian 11 server, one of the most critical steps you can take is setting up a firewall. Think of a firewall as a shield that guards your server against the outside world. It gives you the power to decide what network traffic gets through and what gets blocked. In other words, it’s like having a bouncer at the door of your server, deciding who gets in and who doesn’t. In this guide, we’ll walk you through the process of how to set up a firewall using Uncomplicated Firewall (UFW) on Debian 11.

Table of Contents

  • Why Do You Need a Firewall?
  • Set Up a Firewall with UFW on Debian 11
    • Step 1: Install or Set Up UFW
    • Step 2: Checking UFW Status on Debian 11
    • Step 3: Configuring Default Policies
    • Step 4: Allowing SSH Access
    • Step 5: Allowing Additional Ports
    • Step 6: Enabling UFW on Debian 11
    • Step 7: Verifying the Rules
    • Step 8: Additional UFW Commands on Debian 11
  • Conclusion

Why Do You Need a Firewall?

Before we dive into the practical steps, let’s briefly discuss why having a Firewall on your Debian 11 server is essential. A firewall serves several crucial purposes:

OTHER POSTS

How To Secure SSH with Fail2Ban on Debian 11

How To Install Debian 11 (Bullseye) Server with Pictures

How To Install and Setup Node.js on Debian 11

  • Security: A firewall acts as a shield, blocking unauthorized access to your server. It’s like having a security guard at the entrance to your server, checking who’s allowed in.
  • Access Control: With a firewall, you can specify which services and ports are open to the internet and which are not. This helps prevent unauthorized access to sensitive services.
  • Protection Against Malicious Traffic: Firewalls can filter out malicious traffic, such as DDoS attacks, brute-force login attempts, and known vulnerabilities, keeping your server safe from harm.
  • Privacy: Firewalls help protect your server’s privacy by blocking unwanted or unnecessary network requests.

Now that we understand why a firewall is crucial, let’s get started with setting up UFW on Debian 11.

Set Up a Firewall with UFW on Debian 11

Here’s a simple guide on how to set up a firewall with UFW on Debian 11. By following these steps, you can tap into the advantages it offers:

Step 1: Install or Set Up UFW

Uncomplicated Firewall (UFW) is a user-friendly interface for managing iptables, the default firewall management tool on Debian. To install UFW, open a terminal and run:

Bash
$ sudo apt update
$ sudo apt install ufw

Step 2: Checking UFW Status on Debian 11

After installation, let’s check the status of UFW on Debian 11. You can do this by running:

Bash
$ sudo ufw status

If UFW is inactive on Debian 11, you’ll see a message saying, “Status: inactive.” This means that all incoming and outgoing traffic is allowed. We’ll change that shortly.

Step 3: Configuring Default Policies

Before enabling the firewall, you should define the default policies for incoming and outgoing traffic. By default, UFW denies all incoming traffic and allows all outgoing traffic, which is a good starting point for most servers.

To set these defaults, use the following commands:

Bash
$ sudo ufw default deny incoming
$ sudo ufw default allow outgoing

Step 4: Allowing SSH Access

If you’re connecting to your server via SSH (Secure Shell), you’ll want to allow SSH traffic to ensure you can still access your server. SSH typically uses port 22. To allow SSH traffic, use the following command:

Bash
$ sudo ufw allow ssh

Step 5: Allowing Additional Ports

Depending on your server’s applications and services, you may need to open specific ports. For example, if you’re hosting a web server, you’ll want to allow HTTP (port 80) and HTTPS (port 443) traffic. You can open these ports with commands like:

Bash
$ sudo ufw allow http
$ sudo ufw allow https

Don’t forget to customize these commands to suit your particular requirements. Moreover, carefully think about which ports are essential for your server to work properly, and solely open those.

Step 6: Enabling UFW on Debian 11

Once you’ve configured the default policies and allowed the necessary ports, it’s time to enable UFW on Debian 11. This can be done with:

Bash
$ sudo ufw enable

You’ll be prompted to confirm this action. Type ‘y’ and press Enter to proceed.

Step 7: Verifying the Rules

To confirm that UFW is correctly configured, run:

Bash
$ sudo ufw status

You’ll want to check out a list of permitted ports and services. This is a great way to make sure your settings are on point and that UFW is safeguarding your server just as you want it to Additionally,

Step 8: Additional UFW Commands on Debian 11

Now that you’ve set up a basic firewall with UFW, here are some additional commands you might find useful:

  • To deny a specific port: sudo ufw deny [port]
  • To allow a specific IP address: sudo ufw allow from [IP address]
  • To delete a rule: sudo ufw delete [rule]

Conclusion

Congratulations! You’ve successfully set up a firewall using Uncomplicated Firewall (UFW) on your Debian 11 server. Your server is now better protected against unauthorized access and malicious traffic. However, remember that server security is an ongoing process, and it’s essential to keep your server and firewall rules up to date to stay protected. Regularly review your firewall rules and adapt them as your server’s requirements change. By following these steps and staying vigilant, you’ll help ensure the security and integrity of your Debian 11 server.

Also Read Our Other Guides :

  • How To Set Up a Firewall Using FirewallD on CentOS 7
  • How To Set Up a Firewall Using FirewallD on Rocky Linux 9
  • How To Set Up a Firewall with UFW on Ubuntu 22.04
  • Initial Setup Debian 11 Server: Secure and Efficient
  • Initial Setup Ubuntu Server 22.04: Secure and Efficient
  • Initial Setup Rocky Linux 9 Server: Secure and Efficient
  • How To Install Debian 11 (Bullseye) Server With Pictures

Finally, now you have learned how to set up a firewall using Uncomplicated Firewall (UFW) on Debian 11 Server.

Tags: DebianFirewallInitial SetupSecurityServer GuideUFW

If you got help by our tutorials, please buy me a coffee..!

Buy Me a Coffee

Thank you so much for your support!!

Previous Post

How To Install Nginx on CentOS 7: A Comprehensive Guide

Next Post

How To Install Nginx on Debian 11: A Comprehensive Guide

Leave a Reply Cancel reply

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

RECENT POST

Install and Secure phpMyAdmin on Ubuntu 22.04

How To Install and Secure phpMyAdmin on Ubuntu 22.04

by samm
July 22, 2024
0

Are you ready to take control of your MySQL databases on Ubuntu 22.04? In this step-by-step guide, we'll walk you...

Manage Groups on Linux

A Simple Guide: How To Manage Groups on Linux

by samm
November 12, 2023
0

Are you a Linux enthusiast looking to enhance your system administration skills? One fundamental aspect you should master is how...

Install phpMyAdmin on Rocky Linux 9

How To Install phpMyAdmin on Rocky Linux 9

by samm
November 11, 2023
0

If you're navigating the world of Rocky Linux 9 and looking to streamline your MariaDB or MySQL database management, installing...

Logrotate In Linux

How To Manage Log Files Using Logrotate In Linux

by samm
November 10, 2023
0

Log files are an essential part of any Linux system. They provide valuable insights into the system's activities, helping administrators...

Load More

RECOMMENDED.

Install Redis on Debian

How To Install Redis on Debian 11 Server

October 16, 2023
Secure SSH with Fail2Ban

How To Secure SSH with Fail2Ban on Rocky Linux 9

October 29, 2023
sammlinux sammlinux sammlinux

Related Posts

Secure SSH with Fail2Ban
Debian

How To Secure SSH with Fail2Ban on Debian 11

October 29, 2023
Install Debian 11 Server
Debian

How To Install Debian 11 (Bullseye) Server with Pictures

October 20, 2023
Install and Setup Node.js on Debian 11
Debian

How To Install and Setup Node.js on Debian 11

October 17, 2023
Install PHP 8.2 on Debian 11
Debian

How To Install PHP 8.2 on Debian 11

October 17, 2023
Load More
Next Post
Install Nginx on Debian 11

How To Install Nginx on Debian 11: A Comprehensive Guide

  • About Us
  • Disclaimers
  • Privacy Policy
  • Sitemap

© 2023 sammlinux - Learn Today for Lead Tomorrow.

No Result
View All Result
  • Ubuntu
  • Debian
  • Rocky Linux
  • CentOS
  • Linux

© 2023 sammlinux - Learn Today for Lead Tomorrow.