Skip to content

Techeons

Imagine | Explore | Innovate

Menu
  • Home
Menu

How to setup a firewall in Ubuntu using UFW

Posted on September 5, 2024

UFW (Uncomplicated Firewall) is a user-friendly frontend for managing netfilter firewall rules in Ubuntu. It provides a simple and easy-to-use interface to configure and manage firewall settings.

It is designed to be easy to use and understand, even for users who are new to firewall configuration. It allows users to easily enable or disable the firewall, allow or deny incoming connections, and configure various settings.

Some of the key features of UFW include:

  • Simplified firewall configuration: UFW provides a simple and intuitive way to configure firewall rules.
  • Default deny policy: UFW denies all incoming connections by default, and only allows outgoing connections.
  • Allow and deny rules: Users can easily allow or deny incoming connections based on specific criteria, such as port numbers or IP addresses.
  • Logging and monitoring: UFW provides logging and monitoring capabilities to help users track firewall activity.
  • Integration with other Ubuntu tools: UFW is integrated with other Ubuntu tools, such as the Ubuntu Network Manager.

Some common UFW commands include:

To enable the firewall:

sudo ufw enable

To deny all incoming by default:

sudo ufw default deny incoming

To disable the firewall:

sudo ufw disable

To allow incoming connections on a specific port:

sudo ufw allow <port>

To deny incoming connections on a specific port:

sudo ufw deny <port>

To display the current firewall status:

sudo ufw status

To delete the current firewall rule:

sudo ufw delete <Rule Num>

To allow Webserver connections (Port 80 and Port 443):

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

To reload the firewall config:

sudo ufw reload
Share on Social Media
x facebook pinterest linkedin tumblr reddit emailwhatsapptelegrammastodon

Leave a Reply Cancel reply

You must be logged in to post a comment.

Recent Posts

  • Nginx: How to increase timeout for Nginx
  • Cheat Sheet: Essential Git Commands
  • Setting a default shell in Linux
  • Setting up Composer on Linux
  • Switch easily between Python versions on a Mac using pyenv

Tags

ai alerting aws b2 backblaze certificate cheatsheet cloud commands data-science datalake devops dns docker dremio git gitlab infra jenkins kubernetes linux metabase minikube minio monitoring mount mysql nginx nodejs notebooks openssh php python scala secrets spark ssh ssl ubuntu ufw usb web dev tools windows xampp zeppelin

©2026 Techeons | Design: Newspaperly WordPress Theme